Author: ekohl
Date: Sat Jan 9 21:51:33 2010
New Revision: 45018
URL:
http://svn.reactos.org/svn/reactos?rev=45018&view=rev
Log:
Fix indentation and coding style. No code changes.
Modified:
trunk/reactos/dll/win32/kernel32/process/cmdline.c
trunk/reactos/dll/win32/kernel32/process/job.c
trunk/reactos/dll/win32/kernel32/process/proc.c
trunk/reactos/dll/win32/kernel32/process/procsup.c
trunk/reactos/dll/win32/kernel32/process/session.c
trunk/reactos/dll/win32/kernel32/synch/critical.c
trunk/reactos/dll/win32/kernel32/synch/event.c
trunk/reactos/dll/win32/kernel32/synch/mutex.c
trunk/reactos/dll/win32/kernel32/synch/sem.c
trunk/reactos/dll/win32/kernel32/synch/timer.c
trunk/reactos/dll/win32/kernel32/synch/wait.c
trunk/reactos/dll/win32/kernel32/thread/fiber.c
trunk/reactos/dll/win32/kernel32/thread/fls.c
trunk/reactos/dll/win32/kernel32/thread/tls.c
Modified: trunk/reactos/dll/win32/kernel32/process/cmdline.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/process/cmdline.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/process/cmdline.c [iso-8859-1] Sat Jan 9 21:51:33
2010
@@ -27,80 +27,85 @@
/* FUNCTIONS ****************************************************************/
-static VOID
-InitCommandLines (VOID)
+static
+VOID
+InitCommandLines(VOID)
{
- PRTL_USER_PROCESS_PARAMETERS Params;
+ PRTL_USER_PROCESS_PARAMETERS Params;
- /* FIXME - not thread-safe! */
+ /* FIXME - not thread-safe! */
- // get command line
- Params = NtCurrentPeb()->ProcessParameters;
- RtlNormalizeProcessParams (Params);
+ // get command line
+ Params = NtCurrentPeb()->ProcessParameters;
+ RtlNormalizeProcessParams (Params);
- // initialize command line buffers
- CommandLineStringW.Length = Params->CommandLine.Length;
- CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR);
- CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(),
- HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,
- CommandLineStringW.MaximumLength);
- if (CommandLineStringW.Buffer == NULL)
- {
- return;
- }
+ // initialize command line buffers
+ CommandLineStringW.Length = Params->CommandLine.Length;
+ CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR);
+ CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(),
+ HEAP_GENERATE_EXCEPTIONS |
HEAP_ZERO_MEMORY,
+ CommandLineStringW.MaximumLength);
+ if (CommandLineStringW.Buffer == NULL)
+ {
+ return;
+ }
- RtlInitAnsiString(&CommandLineStringA, NULL);
+ RtlInitAnsiString(&CommandLineStringA, NULL);
- // copy command line
- RtlCopyUnicodeString (&CommandLineStringW,
- &(Params->CommandLine));
- CommandLineStringW.Buffer[CommandLineStringW.Length / sizeof(WCHAR)] = 0;
+ /* Copy command line */
+ RtlCopyUnicodeString(&CommandLineStringW,
+ &(Params->CommandLine));
+ CommandLineStringW.Buffer[CommandLineStringW.Length / sizeof(WCHAR)] = 0;
- /* convert unicode string to ansi (or oem) */
- if (bIsFileApiAnsi)
- RtlUnicodeStringToAnsiString (&CommandLineStringA,
- &CommandLineStringW,
- TRUE);
- else
- RtlUnicodeStringToOemString (&CommandLineStringA,
- &CommandLineStringW,
- TRUE);
+ /* convert unicode string to ansi (or oem) */
+ if (bIsFileApiAnsi)
+ RtlUnicodeStringToAnsiString(&CommandLineStringA,
+ &CommandLineStringW,
+ TRUE);
+ else
+ RtlUnicodeStringToOemString(&CommandLineStringA,
+ &CommandLineStringW,
+ TRUE);
- CommandLineStringA.Buffer[CommandLineStringA.Length] = 0;
+ CommandLineStringA.Buffer[CommandLineStringA.Length] = 0;
- bCommandLineInitialized = TRUE;
+ bCommandLineInitialized = TRUE;
}
/*
* @implemented
*/
-LPSTR WINAPI GetCommandLineA(VOID)
+LPSTR
+WINAPI
+GetCommandLineA(VOID)
{
- if (bCommandLineInitialized == FALSE)
- {
- InitCommandLines ();
- }
+ if (bCommandLineInitialized == FALSE)
+ {
+ InitCommandLines();
+ }
- DPRINT ("CommandLine \'%s\'\n", CommandLineStringA.Buffer);
+ DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer);
- return(CommandLineStringA.Buffer);
+ return CommandLineStringA.Buffer;
}
/*
* @implemented
*/
-LPWSTR WINAPI GetCommandLineW (VOID)
+LPWSTR
+WINAPI
+GetCommandLineW(VOID)
{
- if (bCommandLineInitialized == FALSE)
- {
- InitCommandLines ();
- }
+ if (bCommandLineInitialized == FALSE)
+ {
+ InitCommandLines();
+ }
- DPRINT ("CommandLine \'%S\'\n", CommandLineStringW.Buffer);
+ DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer);
- return(CommandLineStringW.Buffer);
+ return CommandLineStringW.Buffer;
}
/* EOF */
Modified: trunk/reactos/dll/win32/kernel32/process/job.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/process/job.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/process/job.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -27,31 +27,32 @@
CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes,
LPCSTR lpName)
{
- HANDLE hJob;
- ANSI_STRING AnsiName;
- UNICODE_STRING UnicodeName;
-
- if(lpName != NULL)
- {
- NTSTATUS Status;
-
- RtlInitAnsiString(&AnsiName, lpName);
- Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
- }
-
- hJob = CreateJobObjectW(lpJobAttributes,
- ((lpName != NULL) ? UnicodeName.Buffer : NULL));
-
- if(lpName != NULL)
- {
- RtlFreeUnicodeString(&UnicodeName);
- }
- return hJob;
+ HANDLE hJob;
+ ANSI_STRING AnsiName;
+ UNICODE_STRING UnicodeName;
+
+ if (lpName != NULL)
+ {
+ NTSTATUS Status;
+
+ RtlInitAnsiString(&AnsiName, lpName);
+ Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+ }
+
+ hJob = CreateJobObjectW(lpJobAttributes,
+ ((lpName != NULL) ? UnicodeName.Buffer : NULL));
+
+ if (lpName != NULL)
+ {
+ RtlFreeUnicodeString(&UnicodeName);
+ }
+
+ return hJob;
}
@@ -63,47 +64,48 @@
CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes,
LPCWSTR lpName)
{
- UNICODE_STRING JobName;
- OBJECT_ATTRIBUTES ObjectAttributes;
- ULONG Attributes = 0;
- PVOID SecurityDescriptor;
- HANDLE hJob;
- NTSTATUS Status;
-
- if(lpName != NULL)
- {
- RtlInitUnicodeString(&JobName, lpName);
- }
-
- if(lpJobAttributes != NULL)
- {
- if(lpJobAttributes->bInheritHandle)
- {
- Attributes |= OBJ_INHERIT;
- }
- SecurityDescriptor = lpJobAttributes->lpSecurityDescriptor;
- }
- else
- {
- SecurityDescriptor = NULL;
- }
-
- InitializeObjectAttributes(&ObjectAttributes,
- ((lpName != NULL) ? &JobName : NULL),
- Attributes,
- NULL,
- SecurityDescriptor);
-
- Status = NtCreateJobObject(&hJob,
- JOB_OBJECT_ALL_ACCESS,
- &ObjectAttributes);
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return NULL;
- }
-
- return hJob;
+ UNICODE_STRING JobName;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ ULONG Attributes = 0;
+ PVOID SecurityDescriptor;
+ HANDLE hJob;
+ NTSTATUS Status;
+
+ if (lpName != NULL)
+ {
+ RtlInitUnicodeString(&JobName, lpName);
+ }
+
+ if (lpJobAttributes != NULL)
+ {
+ if (lpJobAttributes->bInheritHandle)
+ {
+ Attributes |= OBJ_INHERIT;
+ }
+
+ SecurityDescriptor = lpJobAttributes->lpSecurityDescriptor;
+ }
+ else
+ {
+ SecurityDescriptor = NULL;
+ }
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ ((lpName != NULL) ? &JobName : NULL),
+ Attributes,
+ NULL,
+ SecurityDescriptor);
+
+ Status = NtCreateJobObject(&hJob,
+ JOB_OBJECT_ALL_ACCESS,
+ &ObjectAttributes);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return NULL;
+ }
+
+ return hJob;
}
@@ -116,36 +118,35 @@
BOOL bInheritHandle,
LPCWSTR lpName)
{
- OBJECT_ATTRIBUTES ObjectAttributes;
- UNICODE_STRING JobName;
- HANDLE hJob;
- NTSTATUS Status;
-
- if(lpName == NULL)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- RtlInitUnicodeString(&JobName, lpName);
-
- InitializeObjectAttributes(&ObjectAttributes,
- &JobName,
- (bInheritHandle ? OBJ_INHERIT : 0),
- NULL,
- NULL);
-
- Status = NtOpenJobObject(&hJob,
- dwDesiredAccess,
- &ObjectAttributes);
-
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return NULL;
- }
-
- return hJob;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING JobName;
+ HANDLE hJob;
+ NTSTATUS Status;
+
+ if (lpName == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ RtlInitUnicodeString(&JobName, lpName);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &JobName,
+ (bInheritHandle ? OBJ_INHERIT : 0),
+ NULL,
+ NULL);
+
+ Status = NtOpenJobObject(&hJob,
+ dwDesiredAccess,
+ &ObjectAttributes);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return NULL;
+ }
+
+ return hJob;
}
@@ -158,31 +159,31 @@
BOOL bInheritHandle,
LPCSTR lpName)
{
- ANSI_STRING AnsiName;
- UNICODE_STRING UnicodeName;
- HANDLE hJob;
- NTSTATUS Status;
-
- if(lpName == NULL)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- RtlInitAnsiString(&AnsiName, lpName);
- Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
-
- hJob = OpenJobObjectW(dwDesiredAccess,
- bInheritHandle,
- UnicodeName.Buffer);
-
- RtlFreeUnicodeString(&UnicodeName);
- return hJob;
+ ANSI_STRING AnsiName;
+ UNICODE_STRING UnicodeName;
+ HANDLE hJob;
+ NTSTATUS Status;
+
+ if (lpName == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ RtlInitAnsiString(&AnsiName, lpName);
+ Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ hJob = OpenJobObjectW(dwDesiredAccess,
+ bInheritHandle,
+ UnicodeName.Buffer);
+
+ RtlFreeUnicodeString(&UnicodeName);
+ return hJob;
}
@@ -195,17 +196,17 @@
HANDLE JobHandle,
PBOOL Result)
{
- NTSTATUS Status;
-
- Status = NtIsProcessInJob(ProcessHandle, JobHandle);
- if(NT_SUCCESS(Status))
- {
- *Result = (Status == STATUS_PROCESS_IN_JOB);
- return TRUE;
- }
-
- SetLastErrorByStatus(Status);
- return FALSE;
+ NTSTATUS Status;
+
+ Status = NtIsProcessInJob(ProcessHandle, JobHandle);
+ if (NT_SUCCESS(Status))
+ {
+ *Result = (Status == STATUS_PROCESS_IN_JOB);
+ return TRUE;
+ }
+
+ SetLastErrorByStatus(Status);
+ return FALSE;
}
@@ -217,15 +218,16 @@
AssignProcessToJobObject(HANDLE hJob,
HANDLE hProcess)
{
- NTSTATUS Status;
-
- Status = NtAssignProcessToJobObject(hJob, hProcess);
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
- return TRUE;
+ NTSTATUS Status;
+
+ Status = NtAssignProcessToJobObject(hJob, hProcess);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
}
@@ -240,66 +242,74 @@
DWORD cbJobObjectInformationLength,
LPDWORD lpReturnLength)
{
- NTSTATUS Status;
-
- Status = NtQueryInformationJobObject(hJob,
- JobObjectInformationClass,
- lpJobObjectInformation,
- cbJobObjectInformationLength,
- lpReturnLength);
- 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;
-
- default:
- BasicInfo = NULL;
- break;
- }
-
- if(BasicInfo != NULL)
- {
- /* we need to convert the process priority classes in the
- JOBOBJECT_BASIC_LIMIT_INFORMATION structure the same way as
- GetPriorityClass() converts it! */
- switch(BasicInfo->PriorityClass)
- {
- 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;
- }
- }
-
- return TRUE;
- }
-
- SetLastErrorByStatus(Status);
- return FALSE;
+ NTSTATUS Status;
+
+ Status = NtQueryInformationJobObject(hJob,
+ JobObjectInformationClass,
+ lpJobObjectInformation,
+ cbJobObjectInformationLength,
+ lpReturnLength);
+ 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;
+
+ default:
+ BasicInfo = NULL;
+ break;
+ }
+
+ if (BasicInfo != NULL)
+ {
+ /* we need to convert the process priority classes in the
+ JOBOBJECT_BASIC_LIMIT_INFORMATION structure the same way as
+ GetPriorityClass() converts it! */
+ switch (BasicInfo->PriorityClass)
+ {
+ 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;
+ }
+ }
+
+ return TRUE;
+ }
+
+ SetLastErrorByStatus(Status);
+ return FALSE;
}
@@ -313,83 +323,91 @@
LPVOID lpJobObjectInformation,
DWORD cbJobObjectInformationLength)
{
- JOBOBJECT_EXTENDED_LIMIT_INFORMATION ExtendedLimitInfo;
- PJOBOBJECT_BASIC_LIMIT_INFORMATION BasicInfo;
- PVOID ObjectInfo;
- NTSTATUS Status;
-
- switch(JobObjectInformationClass)
- {
- case JobObjectBasicLimitInformation:
- if(cbJobObjectInformationLength != sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION))
- {
- SetLastError(ERROR_BAD_LENGTH);
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION ExtendedLimitInfo;
+ PJOBOBJECT_BASIC_LIMIT_INFORMATION BasicInfo;
+ PVOID ObjectInfo;
+ NTSTATUS Status;
+
+ switch (JobObjectInformationClass)
+ {
+ case JobObjectBasicLimitInformation:
+ if (cbJobObjectInformationLength !=
sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION))
+ {
+ SetLastError(ERROR_BAD_LENGTH);
+ return FALSE;
+ }
+
+ ObjectInfo = &ExtendedLimitInfo.BasicLimitInformation;
+ BasicInfo = (PJOBOBJECT_BASIC_LIMIT_INFORMATION)ObjectInfo;
+ RtlCopyMemory(ObjectInfo, lpJobObjectInformation,
cbJobObjectInformationLength);
+ break;
+
+ case JobObjectExtendedLimitInformation:
+ if (cbJobObjectInformationLength !=
sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION))
+ {
+ SetLastError(ERROR_BAD_LENGTH);
+ return FALSE;
+ }
+
+ ObjectInfo = &ExtendedLimitInfo;
+ BasicInfo = &ExtendedLimitInfo.BasicLimitInformation;
+ RtlCopyMemory(ObjectInfo, lpJobObjectInformation,
cbJobObjectInformationLength);
+ break;
+
+ default:
+ ObjectInfo = lpJobObjectInformation;
+ BasicInfo = NULL;
+ break;
+ }
+
+ if (BasicInfo != NULL)
+ {
+ /* we need to convert the process priority classes in the
+ JOBOBJECT_BASIC_LIMIT_INFORMATION structure the same way as
+ SetPriorityClass() converts it! */
+ switch(BasicInfo->PriorityClass)
+ {
+ 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;
+ }
+ }
+
+ Status = NtSetInformationJobObject(hJob,
+ JobObjectInformationClass,
+ ObjectInfo,
+ cbJobObjectInformationLength);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
return FALSE;
- }
- ObjectInfo = &ExtendedLimitInfo.BasicLimitInformation;
- BasicInfo = (PJOBOBJECT_BASIC_LIMIT_INFORMATION)ObjectInfo;
- RtlCopyMemory(ObjectInfo, lpJobObjectInformation, cbJobObjectInformationLength);
- break;
-
- case JobObjectExtendedLimitInformation:
- if(cbJobObjectInformationLength != sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION))
- {
- SetLastError(ERROR_BAD_LENGTH);
- return FALSE;
- }
- ObjectInfo = &ExtendedLimitInfo;
- BasicInfo = &ExtendedLimitInfo.BasicLimitInformation;
- RtlCopyMemory(ObjectInfo, lpJobObjectInformation, cbJobObjectInformationLength);
- break;
-
- default:
- ObjectInfo = lpJobObjectInformation;
- BasicInfo = NULL;
- break;
- }
-
- if(BasicInfo != NULL)
- {
- /* we need to convert the process priority classes in the
- JOBOBJECT_BASIC_LIMIT_INFORMATION structure the same way as
- SetPriorityClass() converts it! */
- switch(BasicInfo->PriorityClass)
- {
- 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;
- }
- }
-
- Status = NtSetInformationJobObject(hJob,
- JobObjectInformationClass,
- ObjectInfo,
- cbJobObjectInformationLength);
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
-
- return TRUE;
+ }
+
+ return TRUE;
}
@@ -401,17 +419,16 @@
TerminateJobObject(HANDLE hJob,
UINT uExitCode)
{
- NTSTATUS Status;
-
- Status = NtTerminateJobObject(hJob, uExitCode);
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
+ NTSTATUS Status;
+
+ Status = NtTerminateJobObject(hJob, uExitCode);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
/* EOF */
Modified: trunk/reactos/dll/win32/kernel32/process/proc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/process/proc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/process/proc.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -33,275 +33,286 @@
/*
* @implemented
*/
-BOOL WINAPI
-GetProcessAffinityMask (HANDLE hProcess,
- LPDWORD lpProcessAffinityMask,
- LPDWORD lpSystemAffinityMask)
-{
- PROCESS_BASIC_INFORMATION ProcessInfo;
- SYSTEM_BASIC_INFORMATION SystemInfo;
- NTSTATUS Status;
-
- Status = NtQuerySystemInformation(SystemBasicInformation,
- &SystemInfo,
- sizeof(SystemInfo),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus (Status);
- return FALSE;
- }
-
- Status = NtQueryInformationProcess (hProcess,
- ProcessBasicInformation,
- (PVOID)&ProcessInfo,
- sizeof(PROCESS_BASIC_INFORMATION),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus (Status);
- return FALSE;
- }
-
- *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask;
- *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask;
-
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-SetProcessAffinityMask (HANDLE hProcess,
- DWORD dwProcessAffinityMask)
-{
- NTSTATUS Status;
-
- Status = NtSetInformationProcess (hProcess,
- ProcessAffinityMask,
- (PVOID)&dwProcessAffinityMask,
- sizeof(DWORD));
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus (Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-GetProcessShutdownParameters (LPDWORD lpdwLevel,
- LPDWORD lpdwFlags)
-{
- CSR_API_MESSAGE CsrRequest;
- ULONG Request;
- NTSTATUS Status;
-
- Request = GET_SHUTDOWN_PARAMETERS;
- Status = CsrClientCallServer(&CsrRequest,
- NULL,
- MAKE_CSR_API(Request, CSR_NATIVE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
- {
- SetLastErrorByStatus (Status);
- return(FALSE);
- }
-
- *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level;
- *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags;
-
- return(TRUE);
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-SetProcessShutdownParameters (DWORD dwLevel,
- DWORD dwFlags)
-{
- CSR_API_MESSAGE CsrRequest;
- ULONG Request;
- NTSTATUS Status;
-
- CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel;
- CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags;
-
- Request = SET_SHUTDOWN_PARAMETERS;
- Status = CsrClientCallServer(&CsrRequest,
- NULL,
- MAKE_CSR_API(Request, CSR_NATIVE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
- {
- SetLastErrorByStatus (Status);
- return(FALSE);
- }
-
- return(TRUE);
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-GetProcessWorkingSetSize (HANDLE hProcess,
- PSIZE_T lpMinimumWorkingSetSize,
- PSIZE_T lpMaximumWorkingSetSize)
-{
- QUOTA_LIMITS QuotaLimits;
- NTSTATUS Status;
-
- Status = NtQueryInformationProcess(hProcess,
- ProcessQuotaLimits,
- &QuotaLimits,
- sizeof(QUOTA_LIMITS),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return(FALSE);
- }
-
- *lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize;
- *lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize;
-
- return(TRUE);
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
+BOOL
+WINAPI
+GetProcessAffinityMask(HANDLE hProcess,
+ LPDWORD lpProcessAffinityMask,
+ LPDWORD lpSystemAffinityMask)
+{
+ PROCESS_BASIC_INFORMATION ProcessInfo;
+ SYSTEM_BASIC_INFORMATION SystemInfo;
+ NTSTATUS Status;
+
+ Status = NtQuerySystemInformation(SystemBasicInformation,
+ &SystemInfo,
+ sizeof(SystemInfo),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ Status = NtQueryInformationProcess(hProcess,
+ ProcessBasicInformation,
+ (PVOID)&ProcessInfo,
+ sizeof(PROCESS_BASIC_INFORMATION),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask;
+ *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask;
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+SetProcessAffinityMask(HANDLE hProcess,
+ DWORD dwProcessAffinityMask)
+{
+ NTSTATUS Status;
+
+ Status = NtSetInformationProcess(hProcess,
+ ProcessAffinityMask,
+ (PVOID)&dwProcessAffinityMask,
+ sizeof(DWORD));
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GetProcessShutdownParameters(LPDWORD lpdwLevel,
+ LPDWORD lpdwFlags)
+{
+ CSR_API_MESSAGE CsrRequest;
+ ULONG Request;
+ NTSTATUS Status;
+
+ Request = GET_SHUTDOWN_PARAMETERS;
+ Status = CsrClientCallServer(&CsrRequest,
+ NULL,
+ MAKE_CSR_API(Request, CSR_NATIVE),
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level;
+ *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags;
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+SetProcessShutdownParameters(DWORD dwLevel,
+ DWORD dwFlags)
+{
+ CSR_API_MESSAGE CsrRequest;
+ ULONG Request;
+ NTSTATUS Status;
+
+ CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel;
+ CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags;
+
+ Request = SET_SHUTDOWN_PARAMETERS;
+ Status = CsrClientCallServer(&CsrRequest,
+ NULL,
+ MAKE_CSR_API(Request, CSR_NATIVE),
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GetProcessWorkingSetSize(HANDLE hProcess,
+ PSIZE_T lpMinimumWorkingSetSize,
+ PSIZE_T lpMaximumWorkingSetSize)
+{
+ QUOTA_LIMITS QuotaLimits;
+ NTSTATUS Status;
+
+ Status = NtQueryInformationProcess(hProcess,
+ ProcessQuotaLimits,
+ &QuotaLimits,
+ sizeof(QUOTA_LIMITS),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ *lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize;
+ *lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize;
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
SetProcessWorkingSetSize(HANDLE hProcess,
- SIZE_T dwMinimumWorkingSetSize,
- SIZE_T dwMaximumWorkingSetSize)
-{
- QUOTA_LIMITS QuotaLimits;
- NTSTATUS Status;
-
- QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize;
- QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize;
-
- Status = NtSetInformationProcess(hProcess,
- ProcessQuotaLimits,
- &QuotaLimits,
- sizeof(QUOTA_LIMITS));
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return(FALSE);
- }
-
- return(TRUE);
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
+ SIZE_T dwMinimumWorkingSetSize,
+ SIZE_T dwMaximumWorkingSetSize)
+{
+ QUOTA_LIMITS QuotaLimits;
+ NTSTATUS Status;
+
+ QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize;
+ QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize;
+
+ Status = NtSetInformationProcess(hProcess,
+ ProcessQuotaLimits,
+ &QuotaLimits,
+ sizeof(QUOTA_LIMITS));
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
GetProcessTimes(HANDLE hProcess,
- LPFILETIME lpCreationTime,
- LPFILETIME lpExitTime,
- LPFILETIME lpKernelTime,
- LPFILETIME lpUserTime)
-{
- KERNEL_USER_TIMES Kut;
- NTSTATUS Status;
-
- Status = NtQueryInformationProcess(hProcess,
- ProcessTimes,
- &Kut,
- sizeof(Kut),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return(FALSE);
- }
-
- lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart;
- lpCreationTime->dwHighDateTime = Kut.CreateTime.u.HighPart;
-
- lpExitTime->dwLowDateTime = Kut.ExitTime.u.LowPart;
- lpExitTime->dwHighDateTime = Kut.ExitTime.u.HighPart;
-
- lpKernelTime->dwLowDateTime = Kut.KernelTime.u.LowPart;
- lpKernelTime->dwHighDateTime = Kut.KernelTime.u.HighPart;
-
- lpUserTime->dwLowDateTime = Kut.UserTime.u.LowPart;
- lpUserTime->dwHighDateTime = Kut.UserTime.u.HighPart;
-
- return(TRUE);
-}
-
-
-/*
- * @implemented
- */
-HANDLE WINAPI
+ LPFILETIME lpCreationTime,
+ LPFILETIME lpExitTime,
+ LPFILETIME lpKernelTime,
+ LPFILETIME lpUserTime)
+{
+ KERNEL_USER_TIMES Kut;
+ NTSTATUS Status;
+
+ Status = NtQueryInformationProcess(hProcess,
+ ProcessTimes,
+ &Kut,
+ sizeof(Kut),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart;
+ lpCreationTime->dwHighDateTime = Kut.CreateTime.u.HighPart;
+
+ lpExitTime->dwLowDateTime = Kut.ExitTime.u.LowPart;
+ lpExitTime->dwHighDateTime = Kut.ExitTime.u.HighPart;
+
+ lpKernelTime->dwLowDateTime = Kut.KernelTime.u.LowPart;
+ lpKernelTime->dwHighDateTime = Kut.KernelTime.u.HighPart;
+
+ lpUserTime->dwLowDateTime = Kut.UserTime.u.LowPart;
+ lpUserTime->dwHighDateTime = Kut.UserTime.u.HighPart;
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+HANDLE
+WINAPI
GetCurrentProcess(VOID)
{
- return((HANDLE)NtCurrentProcess());
-}
-
-
-/*
- * @implemented
- */
-HANDLE WINAPI
+ return (HANDLE)NtCurrentProcess();
+}
+
+
+/*
+ * @implemented
+ */
+HANDLE
+WINAPI
GetCurrentThread(VOID)
{
- return((HANDLE)NtCurrentThread());
-}
-
-
-/*
- * @implemented
- */
-DWORD WINAPI
+ return (HANDLE)NtCurrentThread();
+}
+
+
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
GetCurrentProcessId(VOID)
{
- return((DWORD)GetTeb()->ClientId.UniqueProcess);
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
+ return (DWORD)GetTeb()->ClientId.UniqueProcess;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
GetExitCodeProcess(HANDLE hProcess,
- LPDWORD lpExitCode)
-{
- PROCESS_BASIC_INFORMATION ProcessBasic;
- NTSTATUS Status;
-
- Status = NtQueryInformationProcess(hProcess,
- ProcessBasicInformation,
- &ProcessBasic,
- sizeof(PROCESS_BASIC_INFORMATION),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return(FALSE);
- }
-
- *lpExitCode = (DWORD)ProcessBasic.ExitStatus;
-
- return(TRUE);
+ LPDWORD lpExitCode)
+{
+ PROCESS_BASIC_INFORMATION ProcessBasic;
+ NTSTATUS Status;
+
+ Status = NtQueryInformationProcess(hProcess,
+ ProcessBasicInformation,
+ &ProcessBasic,
+ sizeof(PROCESS_BASIC_INFORMATION),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ *lpExitCode = (DWORD)ProcessBasic.ExitStatus;
+
+ return TRUE;
}
@@ -312,226 +323,230 @@
WINAPI
GetProcessId(HANDLE Process)
{
- PROCESS_BASIC_INFORMATION ProcessBasic;
- NTSTATUS Status;
-
- Status = NtQueryInformationProcess(Process,
- ProcessBasicInformation,
- &ProcessBasic,
- sizeof(PROCESS_BASIC_INFORMATION),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return 0;
- }
-
- return (DWORD)ProcessBasic.UniqueProcessId;
-}
-
-
-/*
- * @implemented
- */
-HANDLE WINAPI
+ PROCESS_BASIC_INFORMATION ProcessBasic;
+ NTSTATUS Status;
+
+ Status = NtQueryInformationProcess(Process,
+ ProcessBasicInformation,
+ &ProcessBasic,
+ sizeof(PROCESS_BASIC_INFORMATION),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return 0;
+ }
+
+ return (DWORD)ProcessBasic.UniqueProcessId;
+}
+
+
+/*
+ * @implemented
+ */
+HANDLE
+WINAPI
OpenProcess(DWORD dwDesiredAccess,
- BOOL bInheritHandle,
- DWORD dwProcessId)
-{
- NTSTATUS errCode;
- HANDLE ProcessHandle;
- OBJECT_ATTRIBUTES ObjectAttributes;
- CLIENT_ID ClientId;
-
- ClientId.UniqueProcess = (HANDLE)dwProcessId;
- ClientId.UniqueThread = 0;
-
- InitializeObjectAttributes(&ObjectAttributes,
- NULL,
- (bInheritHandle ? OBJ_INHERIT : 0),
- NULL,
- NULL);
-
- errCode = NtOpenProcess(&ProcessHandle,
- dwDesiredAccess,
- &ObjectAttributes,
- &ClientId);
- if (!NT_SUCCESS(errCode))
- {
- SetLastErrorByStatus (errCode);
- return NULL;
- }
- return ProcessHandle;
-}
-
-
-/*
- * @implemented
- */
-UINT WINAPI
+ BOOL bInheritHandle,
+ DWORD dwProcessId)
+{
+ NTSTATUS errCode;
+ HANDLE ProcessHandle;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ CLIENT_ID ClientId;
+
+ ClientId.UniqueProcess = (HANDLE)dwProcessId;
+ ClientId.UniqueThread = 0;
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ NULL,
+ (bInheritHandle ? OBJ_INHERIT : 0),
+ NULL,
+ NULL);
+
+ errCode = NtOpenProcess(&ProcessHandle,
+ dwDesiredAccess,
+ &ObjectAttributes,
+ &ClientId);
+ if (!NT_SUCCESS(errCode))
+ {
+ SetLastErrorByStatus(errCode);
+ return NULL;
+ }
+
+ return ProcessHandle;
+}
+
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
WinExec(LPCSTR lpCmdLine,
- UINT uCmdShow)
-{
- STARTUPINFOA StartupInfo;
- PROCESS_INFORMATION ProcessInformation;
- DWORD dosErr;
-
- RtlZeroMemory(&StartupInfo, sizeof(StartupInfo));
- StartupInfo.cb = sizeof(STARTUPINFOA);
- StartupInfo.wShowWindow = (WORD)uCmdShow;
- StartupInfo.dwFlags = 0;
-
- if (! CreateProcessA(NULL,
- (PVOID)lpCmdLine,
- NULL,
- NULL,
- FALSE,
- 0,
- NULL,
- NULL,
- &StartupInfo,
- &ProcessInformation))
- {
- dosErr = GetLastError();
- return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT;
- }
- if (NULL != lpfnGlobalRegisterWaitForInputIdle)
- {
- lpfnGlobalRegisterWaitForInputIdle (
- ProcessInformation.hProcess,
- 10000
- );
- }
- NtClose(ProcessInformation.hProcess);
- NtClose(ProcessInformation.hThread);
-
- return 33; /* Something bigger than 31 means success. */
-}
-
-
-/*
- * @implemented
- */
-VOID WINAPI
-RegisterWaitForInputIdle (
- WaitForInputIdleType lpfnRegisterWaitForInputIdle
- )
-{
- lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle;
- return;
-}
-
-/*
- * @implemented
- */
-VOID WINAPI
+ UINT uCmdShow)
+{
+ STARTUPINFOA StartupInfo;
+ PROCESS_INFORMATION ProcessInformation;
+ DWORD dosErr;
+
+ RtlZeroMemory(&StartupInfo, sizeof(StartupInfo));
+ StartupInfo.cb = sizeof(STARTUPINFOA);
+ StartupInfo.wShowWindow = (WORD)uCmdShow;
+ StartupInfo.dwFlags = 0;
+
+ if (!CreateProcessA(NULL,
+ (PVOID)lpCmdLine,
+ NULL,
+ NULL,
+ FALSE,
+ 0,
+ NULL,
+ NULL,
+ &StartupInfo,
+ &ProcessInformation))
+ {
+ dosErr = GetLastError();
+ return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT;
+ }
+
+ if (NULL != lpfnGlobalRegisterWaitForInputIdle)
+ {
+ lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess,
+ 10000);
+ }
+
+ NtClose(ProcessInformation.hProcess);
+ NtClose(ProcessInformation.hThread);
+
+ return 33; /* Something bigger than 31 means success. */
+}
+
+
+/*
+ * @implemented
+ */
+VOID
+WINAPI
+RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle)
+{
+ lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle;
+ return;
+}
+
+/*
+ * @implemented
+ */
+VOID
+WINAPI
GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
{
- PRTL_USER_PROCESS_PARAMETERS Params;
-
- if (lpStartupInfo == NULL)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return;
- }
-
- Params = NtCurrentPeb()->ProcessParameters;
-
- lpStartupInfo->cb = sizeof(STARTUPINFOW);
- lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer;
- lpStartupInfo->lpTitle = Params->WindowTitle.Buffer;
- lpStartupInfo->dwX = Params->StartingX;
- lpStartupInfo->dwY = Params->StartingY;
- lpStartupInfo->dwXSize = Params->CountX;
- lpStartupInfo->dwYSize = Params->CountY;
- lpStartupInfo->dwXCountChars = Params->CountCharsX;
- lpStartupInfo->dwYCountChars = Params->CountCharsY;
- lpStartupInfo->dwFillAttribute = Params->FillAttribute;
- lpStartupInfo->dwFlags = Params->WindowFlags;
- lpStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags;
- lpStartupInfo->cbReserved2 = Params->RuntimeData.Length;
- lpStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer;
-
- lpStartupInfo->hStdInput = Params->StandardInput;
- lpStartupInfo->hStdOutput = Params->StandardOutput;
- lpStartupInfo->hStdError = Params->StandardError;
-}
-
-
-/*
- * @implemented
- */
-VOID WINAPI
+ PRTL_USER_PROCESS_PARAMETERS Params;
+
+ if (lpStartupInfo == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return;
+ }
+
+ Params = NtCurrentPeb()->ProcessParameters;
+
+ lpStartupInfo->cb = sizeof(STARTUPINFOW);
+ lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer;
+ lpStartupInfo->lpTitle = Params->WindowTitle.Buffer;
+ lpStartupInfo->dwX = Params->StartingX;
+ lpStartupInfo->dwY = Params->StartingY;
+ lpStartupInfo->dwXSize = Params->CountX;
+ lpStartupInfo->dwYSize = Params->CountY;
+ lpStartupInfo->dwXCountChars = Params->CountCharsX;
+ lpStartupInfo->dwYCountChars = Params->CountCharsY;
+ lpStartupInfo->dwFillAttribute = Params->FillAttribute;
+ lpStartupInfo->dwFlags = Params->WindowFlags;
+ lpStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags;
+ lpStartupInfo->cbReserved2 = Params->RuntimeData.Length;
+ lpStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer;
+
+ lpStartupInfo->hStdInput = Params->StandardInput;
+ lpStartupInfo->hStdOutput = Params->StandardOutput;
+ lpStartupInfo->hStdError = Params->StandardError;
+}
+
+
+/*
+ * @implemented
+ */
+VOID
+WINAPI
GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
{
- PRTL_USER_PROCESS_PARAMETERS Params;
- ANSI_STRING AnsiString;
-
- if (lpStartupInfo == NULL)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return;
- }
-
- Params = NtCurrentPeb ()->ProcessParameters;
-
- RtlAcquirePebLock ();
-
- /* FIXME - not thread-safe */
- if (lpLocalStartupInfo == NULL)
- {
- /* create new local startup info (ansi) */
- lpLocalStartupInfo = RtlAllocateHeap (RtlGetProcessHeap (),
- 0,
- sizeof(STARTUPINFOA));
+ PRTL_USER_PROCESS_PARAMETERS Params;
+ ANSI_STRING AnsiString;
+
+ if (lpStartupInfo == NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return;
+ }
+
+ Params = NtCurrentPeb ()->ProcessParameters;
+
+ RtlAcquirePebLock ();
+
+ /* FIXME - not thread-safe */
+ if (lpLocalStartupInfo == NULL)
+ {
+ /* create new local startup info (ansi) */
+ lpLocalStartupInfo = RtlAllocateHeap(RtlGetProcessHeap(),
+ 0,
+ sizeof(STARTUPINFOA));
if (lpLocalStartupInfo == NULL)
{
- RtlReleasePebLock ();
+ RtlReleasePebLock();
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return;
}
- lpLocalStartupInfo->cb = sizeof(STARTUPINFOA);
-
- /* copy window title string */
- RtlUnicodeStringToAnsiString (&AnsiString,
- &Params->WindowTitle,
- TRUE);
- lpLocalStartupInfo->lpTitle = AnsiString.Buffer;
-
- /* copy desktop info string */
- RtlUnicodeStringToAnsiString (&AnsiString,
- &Params->DesktopInfo,
- TRUE);
- lpLocalStartupInfo->lpDesktop = AnsiString.Buffer;
-
- /* copy shell info string */
- RtlUnicodeStringToAnsiString (&AnsiString,
- &Params->ShellInfo,
- TRUE);
- lpLocalStartupInfo->lpReserved = AnsiString.Buffer;
-
- lpLocalStartupInfo->dwX = Params->StartingX;
- lpLocalStartupInfo->dwY = Params->StartingY;
- lpLocalStartupInfo->dwXSize = Params->CountX;
- lpLocalStartupInfo->dwYSize = Params->CountY;
- lpLocalStartupInfo->dwXCountChars = Params->CountCharsX;
- lpLocalStartupInfo->dwYCountChars = Params->CountCharsY;
- lpLocalStartupInfo->dwFillAttribute = Params->FillAttribute;
- lpLocalStartupInfo->dwFlags = Params->WindowFlags;
- lpLocalStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags;
- lpLocalStartupInfo->cbReserved2 = Params->RuntimeData.Length;
- lpLocalStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer;
-
- lpLocalStartupInfo->hStdInput = Params->StandardInput;
- lpLocalStartupInfo->hStdOutput = Params->StandardOutput;
- lpLocalStartupInfo->hStdError = Params->StandardError;
- }
-
- RtlReleasePebLock ();
-
- /* copy local startup info data to external startup info */
- memcpy (lpStartupInfo,
+ lpLocalStartupInfo->cb = sizeof(STARTUPINFOA);
+
+ /* copy window title string */
+ RtlUnicodeStringToAnsiString(&AnsiString,
+ &Params->WindowTitle,
+ TRUE);
+ lpLocalStartupInfo->lpTitle = AnsiString.Buffer;
+
+ /* copy desktop info string */
+ RtlUnicodeStringToAnsiString(&AnsiString,
+ &Params->DesktopInfo,
+ TRUE);
+ lpLocalStartupInfo->lpDesktop = AnsiString.Buffer;
+
+ /* copy shell info string */
+ RtlUnicodeStringToAnsiString(&AnsiString,
+ &Params->ShellInfo,
+ TRUE);
+ lpLocalStartupInfo->lpReserved = AnsiString.Buffer;
+
+ lpLocalStartupInfo->dwX = Params->StartingX;
+ lpLocalStartupInfo->dwY = Params->StartingY;
+ lpLocalStartupInfo->dwXSize = Params->CountX;
+ lpLocalStartupInfo->dwYSize = Params->CountY;
+ lpLocalStartupInfo->dwXCountChars = Params->CountCharsX;
+ lpLocalStartupInfo->dwYCountChars = Params->CountCharsY;
+ lpLocalStartupInfo->dwFillAttribute = Params->FillAttribute;
+ lpLocalStartupInfo->dwFlags = Params->WindowFlags;
+ lpLocalStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags;
+ lpLocalStartupInfo->cbReserved2 = Params->RuntimeData.Length;
+ lpLocalStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer;
+
+ lpLocalStartupInfo->hStdInput = Params->StandardInput;
+ lpLocalStartupInfo->hStdOutput = Params->StandardOutput;
+ lpLocalStartupInfo->hStdError = Params->StandardError;
+ }
+
+ RtlReleasePebLock();
+
+ /* copy local startup info data to external startup info */
+ memcpy(lpStartupInfo,
lpLocalStartupInfo,
sizeof(STARTUPINFOA));
}
@@ -540,112 +555,118 @@
/*
* @implemented
*/
-BOOL WINAPI
-FlushInstructionCache (HANDLE hProcess,
- LPCVOID lpBaseAddress,
- DWORD dwSize)
-{
- NTSTATUS Status;
-
- Status = NtFlushInstructionCache(hProcess,
- (PVOID)lpBaseAddress,
- dwSize);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
+BOOL
+WINAPI
+FlushInstructionCache(HANDLE hProcess,
+ LPCVOID lpBaseAddress,
+ DWORD dwSize)
+{
+ NTSTATUS Status;
+
+ Status = NtFlushInstructionCache(hProcess,
+ (PVOID)lpBaseAddress,
+ dwSize);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+VOID
+WINAPI
+ExitProcess(UINT uExitCode)
+{
+ CSR_API_MESSAGE CsrRequest;
+ ULONG Request;
+ NTSTATUS Status;
+
+ /* kill sibling threads ... we want to be alone at this point */
+ NtTerminateProcess(NULL, 0);
+
+ /* unload all dll's */
+ LdrShutdownProcess();
+
+ /* notify csrss of process termination */
+ Request = TERMINATE_PROCESS;
+ Status = CsrClientCallServer(&CsrRequest,
+ NULL,
+ MAKE_CSR_API(Request, CSR_NATIVE),
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
+ {
+ DPRINT("Failed to tell csrss about terminating process\n");
+ }
+
+ NtTerminateProcess(NtCurrentProcess (),
+ uExitCode);
+
+ /* should never get here */
+ ASSERT(0);
+ while(1);
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+TerminateProcess(HANDLE hProcess,
+ UINT uExitCode)
+{
+ NTSTATUS Status;
+
+ if (hProcess == NULL)
+ {
return FALSE;
}
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-VOID WINAPI
-ExitProcess(UINT uExitCode)
-{
- CSR_API_MESSAGE CsrRequest;
- ULONG Request;
- NTSTATUS Status;
-
- /* kill sibling threads ... we want to be alone at this point */
- NtTerminateProcess (NULL, 0);
-
- /* unload all dll's */
- LdrShutdownProcess ();
-
- /* notify csrss of process termination */
- Request = TERMINATE_PROCESS;
- Status = CsrClientCallServer(&CsrRequest,
- NULL,
- MAKE_CSR_API(Request, CSR_NATIVE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
- {
- DPRINT("Failed to tell csrss about terminating process\n");
- }
-
-
- NtTerminateProcess (NtCurrentProcess (),
- uExitCode);
-
- /* should never get here */
- ASSERT(0);
- while(1);
-}
-
-
-/*
- * @implemented
- */
-BOOL WINAPI
-TerminateProcess (HANDLE hProcess,
- UINT uExitCode)
-{
- NTSTATUS Status;
-
- if (hProcess == NULL)
- {
- return FALSE;
- }
-
- Status = NtTerminateProcess (hProcess, uExitCode);
- if (NT_SUCCESS(Status))
- {
- return TRUE;
- }
- SetLastErrorByStatus (Status);
- return FALSE;
+
+ Status = NtTerminateProcess(hProcess, uExitCode);
+ if (NT_SUCCESS(Status))
+ {
+ return TRUE;
+ }
+
+ SetLastErrorByStatus(Status);
+ return FALSE;
}
/*
* @unimplemented
*/
-VOID WINAPI
+VOID
+WINAPI
FatalAppExitA(UINT uAction,
- LPCSTR lpMessageText)
-{
- UNICODE_STRING MessageTextU;
- ANSI_STRING MessageText;
-
- RtlInitAnsiString (&MessageText, (LPSTR) lpMessageText);
-
- RtlAnsiStringToUnicodeString (&MessageTextU,
- &MessageText,
- TRUE);
-
- FatalAppExitW (uAction, MessageTextU.Buffer);
-
- RtlFreeUnicodeString (&MessageTextU);
+ LPCSTR lpMessageText)
+{
+ UNICODE_STRING MessageTextU;
+ ANSI_STRING MessageText;
+
+ RtlInitAnsiString(&MessageText, (LPSTR)lpMessageText);
+
+ RtlAnsiStringToUnicodeString(&MessageTextU,
+ &MessageText,
+ TRUE);
+
+ FatalAppExitW(uAction, MessageTextU.Buffer);
+
+ RtlFreeUnicodeString(&MessageTextU);
}
/*
* @unimplemented
*/
-VOID WINAPI
+VOID
+WINAPI
FatalAppExitW(UINT uAction,
LPCWSTR lpMessageText)
{
@@ -657,7 +678,7 @@
DPRINT1("AppExit\n");
if (hModule)
- pMessageBoxW = (MessageBoxW_Proc) GetProcAddress(hModule,
"MessageBoxW");
+ pMessageBoxW = (MessageBoxW_Proc)GetProcAddress(hModule,
"MessageBoxW");
if (pMessageBoxW)
pMessageBoxW(0, lpMessageText, NULL, MB_SYSTEMMODAL | MB_OK);
@@ -671,18 +692,20 @@
/*
* @implemented
*/
-VOID WINAPI
-FatalExit (int ExitCode)
-{
- ExitProcess(ExitCode);
-}
-
-
-/*
- * @implemented
- */
-DWORD WINAPI
-GetPriorityClass (HANDLE hProcess)
+VOID
+WINAPI
+FatalExit(int ExitCode)
+{
+ ExitProcess(ExitCode);
+}
+
+
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
+GetPriorityClass(HANDLE hProcess)
{
NTSTATUS Status;
PROCESS_PRIORITY_CLASS PriorityClass;
@@ -727,65 +750,66 @@
/*
* @implemented
*/
-BOOL WINAPI
-SetPriorityClass (HANDLE hProcess,
- DWORD dwPriorityClass)
-{
- NTSTATUS Status;
- PROCESS_PRIORITY_CLASS PriorityClass;
-
- switch(dwPriorityClass)
- {
- case IDLE_PRIORITY_CLASS:
- PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_IDLE;
- break;
-
- case BELOW_NORMAL_PRIORITY_CLASS:
- PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_BELOW_NORMAL;
- break;
-
- case NORMAL_PRIORITY_CLASS:
- PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
- break;
-
- case ABOVE_NORMAL_PRIORITY_CLASS:
- PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_ABOVE_NORMAL;
- break;
-
- case HIGH_PRIORITY_CLASS:
- PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_HIGH;
- break;
-
- case REALTIME_PRIORITY_CLASS:
- PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME;
- break;
-
- default:
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- PriorityClass.Foreground = FALSE;
-
- Status = NtSetInformationProcess(hProcess,
- ProcessPriorityClass,
- &PriorityClass,
- sizeof(PROCESS_PRIORITY_CLASS));
-
- if(!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-DWORD WINAPI
+BOOL
+WINAPI
+SetPriorityClass(HANDLE hProcess,
+ DWORD dwPriorityClass)
+{
+ NTSTATUS Status;
+ PROCESS_PRIORITY_CLASS PriorityClass;
+
+ switch (dwPriorityClass)
+ {
+ case IDLE_PRIORITY_CLASS:
+ PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_IDLE;
+ break;
+
+ case BELOW_NORMAL_PRIORITY_CLASS:
+ PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_BELOW_NORMAL;
+ break;
+
+ case NORMAL_PRIORITY_CLASS:
+ PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
+ break;
+
+ case ABOVE_NORMAL_PRIORITY_CLASS:
+ PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_ABOVE_NORMAL;
+ break;
+
+ case HIGH_PRIORITY_CLASS:
+ PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_HIGH;
+ break;
+
+ case REALTIME_PRIORITY_CLASS:
+ PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME;
+ break;
+
+ default:
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ PriorityClass.Foreground = FALSE;
+
+ Status = NtSetInformationProcess(hProcess,
+ ProcessPriorityClass,
+ &PriorityClass,
+ sizeof(PROCESS_PRIORITY_CLASS));
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
GetProcessVersion(DWORD ProcessId)
{
DWORD Version = 0;
@@ -801,17 +825,18 @@
_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 @@
&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 @@
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 @@
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 @@
}
_SEH2_FINALLY
{
- if (ProcessHandle) CloseHandle(ProcessHandle);
+ if (ProcessHandle)
+ CloseHandle(ProcessHandle);
}
_SEH2_END;
@@ -877,24 +911,23 @@
*/
BOOL
WINAPI
-GetProcessIoCounters(
- HANDLE hProcess,
- PIO_COUNTERS lpIoCounters)
-{
- NTSTATUS Status;
-
- Status = NtQueryInformationProcess(hProcess,
- ProcessIoCounters,
- lpIoCounters,
- sizeof(IO_COUNTERS),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return(FALSE);
- }
-
- return TRUE;
+GetProcessIoCounters(HANDLE hProcess,
+ PIO_COUNTERS lpIoCounters)
+{
+ NTSTATUS Status;
+
+ Status = NtQueryInformationProcess(hProcess,
+ ProcessIoCounters,
+ lpIoCounters,
+ sizeof(IO_COUNTERS),
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
}
@@ -906,22 +939,22 @@
GetProcessPriorityBoost(HANDLE hProcess,
PBOOL pDisablePriorityBoost)
{
- NTSTATUS Status;
- ULONG PriorityBoost;
-
- Status = NtQueryInformationProcess(hProcess,
- ProcessPriorityBoost,
- &PriorityBoost,
- sizeof(ULONG),
- NULL);
- if (NT_SUCCESS(Status))
- {
- *pDisablePriorityBoost = PriorityBoost;
- return TRUE;
- }
-
- SetLastErrorByStatus(Status);
- return FALSE;
+ NTSTATUS Status;
+ ULONG PriorityBoost;
+
+ Status = NtQueryInformationProcess(hProcess,
+ ProcessPriorityBoost,
+ &PriorityBoost,
+ sizeof(ULONG),
+ NULL);
+ if (NT_SUCCESS(Status))
+ {
+ *pDisablePriorityBoost = PriorityBoost;
+ return TRUE;
+ }
+
+ SetLastErrorByStatus(Status);
+ return FALSE;
}
@@ -933,20 +966,20 @@
SetProcessPriorityBoost(HANDLE hProcess,
BOOL bDisablePriorityBoost)
{
- NTSTATUS Status;
- ULONG PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); /* prevent setting values
other than 1 and 0 */
-
- Status = NtSetInformationProcess(hProcess,
- ProcessPriorityBoost,
- &PriorityBoost,
- sizeof(ULONG));
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return FALSE;
- }
-
- return TRUE;
+ NTSTATUS Status;
+ ULONG PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); /* prevent setting
values other than 1 and 0 */
+
+ Status = NtSetInformationProcess(hProcess,
+ ProcessPriorityBoost,
+ &PriorityBoost,
+ sizeof(ULONG));
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return FALSE;
+ }
+
+ return TRUE;
}
@@ -982,10 +1015,8 @@
*/
BOOL
WINAPI
-IsWow64Process(
- HANDLE hProcess,
- PBOOL Wow64Process
- )
+IsWow64Process(HANDLE hProcess,
+ PBOOL Wow64Process)
{
ULONG pbi;
NTSTATUS Status;
@@ -995,7 +1026,6 @@
&pbi,
sizeof(pbi),
NULL);
-
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -1003,6 +1033,7 @@
}
*Wow64Process = (pbi != 0);
+
return TRUE;
}
@@ -1044,9 +1075,11 @@
&Needed);
Result = DynamicBuffer;
}
- else Result = (PUNICODE_STRING)Buffer;
-
- if (!NT_SUCCESS(Status)) goto Cleanup;
+ else
+ Result = (PUNICODE_STRING)Buffer;
+
+ if (!NT_SUCCESS(Status))
+ goto Cleanup;
if (Result->Length / sizeof(WCHAR) + 1 > *pdwSize)
{
@@ -1065,6 +1098,7 @@
{
SetLastErrorByStatus(Status);
}
+
return !Status;
}
@@ -1101,6 +1135,7 @@
lpExeName,
*pdwSize,
NULL, NULL));
+
if (Result)
*pdwSize = strlen(lpExeName);
Modified: trunk/reactos/dll/win32/kernel32/process/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/process/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/process/procsup.c [iso-8859-1] Sat Jan 9 21:51:33
2010
@@ -294,7 +294,8 @@
"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 @@
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 */
@@ -1177,7 +1179,7 @@
hSection,
hDebug,
NULL);
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create process, status 0x%x\n", Status);
SetLastErrorByStatus(Status);
@@ -1311,7 +1313,8 @@
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 @@
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;
Modified: trunk/reactos/dll/win32/kernel32/process/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/process/session.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/process/session.c [iso-8859-1] Sat Jan 9 21:51:33
2010
@@ -19,11 +19,14 @@
/*
* @unimplemented
*/
-DWORD WINAPI
-DosPathToSessionPathW (DWORD SessionID, LPWSTR InPath, LPWSTR * OutPath)
+DWORD
+WINAPI
+DosPathToSessionPathW(DWORD SessionID,
+ LPWSTR InPath,
+ LPWSTR *OutPath)
{
UNIMPLEMENTED;
- return 0;
+ return 0;
}
/*
@@ -39,68 +42,74 @@
*
* @unimplemented
*/
-DWORD WINAPI
-DosPathToSessionPathA (DWORD SessionId, LPSTR InPath, LPSTR * OutPath)
+DWORD
+WINAPI
+DosPathToSessionPathA(DWORD SessionId,
+ LPSTR InPath,
+ LPSTR *OutPath)
{
- //DosPathToSessionPathW (SessionId,InPathW,OutPathW);
+ //DosPathToSessionPathW (SessionId,InPathW,OutPathW);
UNIMPLEMENTED;
- return 0;
+ return 0;
}
/*
* @implemented
*/
-BOOL WINAPI ProcessIdToSessionId (IN DWORD dwProcessId,
- OUT DWORD* pSessionId)
+BOOL
+WINAPI
+ProcessIdToSessionId(IN DWORD dwProcessId,
+ OUT DWORD *pSessionId)
{
- PROCESS_SESSION_INFORMATION SessionInformation;
- OBJECT_ATTRIBUTES ObjectAttributes;
- CLIENT_ID ClientId;
- HANDLE ProcessHandle;
- NTSTATUS Status;
+ PROCESS_SESSION_INFORMATION SessionInformation;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ CLIENT_ID ClientId;
+ HANDLE ProcessHandle;
+ NTSTATUS Status;
- if(IsBadWritePtr(pSessionId, sizeof(DWORD)))
- {
- SetLastError(ERROR_INVALID_PARAMETER);
+ if (IsBadWritePtr(pSessionId, sizeof(DWORD)))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ ClientId.UniqueProcess = (HANDLE)dwProcessId;
+ ClientId.UniqueThread = 0;
+
+ InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);
+
+ Status = NtOpenProcess(&ProcessHandle,
+ PROCESS_QUERY_INFORMATION,
+ &ObjectAttributes,
+ &ClientId);
+ if (NT_SUCCESS(Status))
+ {
+ Status = NtQueryInformationProcess(ProcessHandle,
+ ProcessSessionInformation,
+ &SessionInformation,
+ sizeof(SessionInformation),
+ NULL);
+ NtClose(ProcessHandle);
+
+ if (NT_SUCCESS(Status))
+ {
+ *pSessionId = SessionInformation.SessionId;
+ return TRUE;
+ }
+ }
+
+ SetLastErrorByStatus(Status);
return FALSE;
- }
-
- ClientId.UniqueProcess = (HANDLE)dwProcessId;
- ClientId.UniqueThread = 0;
-
- InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);
-
- Status = NtOpenProcess(&ProcessHandle,
- PROCESS_QUERY_INFORMATION,
- &ObjectAttributes,
- &ClientId);
- if(NT_SUCCESS(Status))
- {
- Status = NtQueryInformationProcess(ProcessHandle,
- ProcessSessionInformation,
- &SessionInformation,
- sizeof(SessionInformation),
- NULL);
- NtClose(ProcessHandle);
-
- if(NT_SUCCESS(Status))
- {
- *pSessionId = SessionInformation.SessionId;
- return TRUE;
- }
- }
-
- SetLastErrorByStatus(Status);
- return FALSE;
}
/*
* @implemented
*/
-DWORD WINAPI
-WTSGetActiveConsoleSessionId (VOID)
+DWORD
+WINAPI
+WTSGetActiveConsoleSessionId(VOID)
{
- return ActiveConsoleSessionId;
+ return ActiveConsoleSessionId;
}
/* EOF */
Modified: trunk/reactos/dll/win32/kernel32/synch/critical.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/c…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/synch/critical.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/synch/critical.c [iso-8859-1] Sat Jan 9 21:51:33
2010
@@ -26,8 +26,9 @@
/* 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);
}
/*
Modified: trunk/reactos/dll/win32/kernel32/synch/event.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/e…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/synch/event.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/synch/event.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -72,10 +72,10 @@
/* Now check if we got a name */
if (lpName) RtlInitUnicodeString(&ObjectName, lpName);
- /* Check for invalid flags */
+ /* Check for invalid flags */
if (dwFlags & ~(CREATE_EVENT_INITIAL_SET | CREATE_EVENT_MANUAL_RESET))
{
- /* Fail */
+ /* Fail */
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
Modified: trunk/reactos/dll/win32/kernel32/synch/mutex.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/m…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/synch/mutex.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/synch/mutex.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -75,7 +75,8 @@
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 @@
/* 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);
Modified: trunk/reactos/dll/win32/kernel32/synch/sem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/s…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/synch/sem.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/synch/sem.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -80,7 +80,8 @@
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 @@
/* 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);
Modified: trunk/reactos/dll/win32/kernel32/synch/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/t…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/synch/timer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/synch/timer.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -75,7 +75,8 @@
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 @@
(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 @@
/* 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);
Modified: trunk/reactos/dll/win32/kernel32/synch/wait.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/synch/w…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/synch/wait.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/synch/wait.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -36,9 +36,9 @@
IN DWORD dwMilliseconds,
IN BOOL bAlertable)
{
- PLARGE_INTEGER TimePtr;
- LARGE_INTEGER Time;
- NTSTATUS Status;
+ PLARGE_INTEGER TimePtr;
+ LARGE_INTEGER Time;
+ NTSTATUS Status;
/* Get real handle */
hHandle = TranslateStdHandle(hHandle);
Modified: trunk/reactos/dll/win32/kernel32/thread/fiber.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/thread/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/thread/fiber.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/thread/fiber.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -37,7 +37,7 @@
DPRINT1("Converting Fiber to Thread\n");
/* the current thread isn't running a fiber: failure */
- if(!pTeb->HasFiberData)
+ if (!pTeb->HasFiberData)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
@@ -47,7 +47,7 @@
pTeb->HasFiberData = FALSE;
/* free the fiber */
- if(pTeb->Tib.FiberData != NULL)
+ if (pTeb->Tib.FiberData != NULL)
{
RtlFreeHeap(GetProcessHeap(), 0, pTeb->Tib.FiberData);
}
@@ -69,7 +69,8 @@
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(),
@@ -77,7 +78,7 @@
sizeof(FIBER));
/* failure */
- if(pfCurFiber == NULL)
+ if (pfCurFiber == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
@@ -93,7 +94,7 @@
pfCurFiber->GuaranteedStackBytes = pTeb->GuaranteedStackBytes;
pfCurFiber->ActivationContextStack = pTeb->ActivationContextStackPointer;
pfCurFiber->Context.ContextFlags = CONTEXT_FULL;
-
+
/* Save FPU State if requsted */
if (dwFlags & FIBER_FLAG_FLOAT_SWITCH)
{
@@ -150,17 +151,17 @@
PVOID ActivationContextStack = NULL;
DPRINT1("Creating Fiber\n");
- #ifdef SXS_SUPPORT_ENABLED
+#ifdef SXS_SUPPORT_ENABLED
/* Allocate the Activation Context Stack */
nErrCode = RtlAllocateActivationContextStack(&ActivationContextStack);
- #endif
-
+#endif
+
/* Allocate the fiber */
pfCurFiber = (PFIBER)RtlAllocateHeap(GetProcessHeap(),
0,
sizeof(FIBER));
/* Failure */
- if(pfCurFiber == NULL)
+ if (pfCurFiber == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
@@ -181,10 +182,10 @@
SetLastErrorByStatus(nErrCode);
return NULL;
}
-
+
/* Clear the context */
RtlZeroMemory(&pfCurFiber->Context, sizeof(CONTEXT));
-
+
/* copy the data into the fiber */
pfCurFiber->StackBase = usFiberInitialTeb.StackBase;
pfCurFiber->StackLimit = usFiberInitialTeb.StackLimit;
@@ -195,20 +196,20 @@
pfCurFiber->FlsData = NULL;
pfCurFiber->ActivationContextStack = ActivationContextStack;
pfCurFiber->Context.ContextFlags = CONTEXT_FULL;
-
+
/* Save FPU State if requsted */
if (dwFlags & FIBER_FLAG_FLOAT_SWITCH)
{
pfCurFiber->Context.ContextFlags |= CONTEXT_FLOATING_POINT;
}
-
+
/* initialize the context for the fiber */
BasepInitializeContext(&ctxFiberContext,
lpParameter,
lpStartAddress,
usFiberInitialTeb.StackBase,
2);
-
+
/* Return the Fiber */
return pfCurFiber;
}
@@ -227,7 +228,8 @@
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(),
Modified: trunk/reactos/dll/win32/kernel32/thread/fls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/thread/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/thread/fls.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/thread/fls.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -18,101 +18,109 @@
/*
* @unimplemented
*/
-DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback)
+DWORD
+WINAPI
+FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback)
{
- (void)lpCallback;
+ (void)lpCallback;
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FLS_OUT_OF_INDEXES;
+ UNIMPLEMENTED;
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FLS_OUT_OF_INDEXES;
}
/*
* @unimplemented
*/
-BOOL WINAPI FlsFree(DWORD dwFlsIndex)
+BOOL
+WINAPI
+FlsFree(DWORD dwFlsIndex)
{
- (void)dwFlsIndex;
+ (void)dwFlsIndex;
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+ UNIMPLEMENTED;
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE;
}
/*
* @implemented
*/
-PVOID WINAPI FlsGetValue(DWORD dwFlsIndex)
+PVOID
+WINAPI
+FlsGetValue(DWORD dwFlsIndex)
{
- PVOID * ppFlsSlots;
- PVOID pRetVal;
+ PVOID *ppFlsSlots;
+ PVOID pRetVal;
- if(dwFlsIndex >= 128) goto l_InvalidParam;
+ if (dwFlsIndex >= 128)
+ goto l_InvalidParam;
- ppFlsSlots = NtCurrentTeb()->FlsData;
+ ppFlsSlots = NtCurrentTeb()->FlsData;
- if(ppFlsSlots == NULL) goto l_InvalidParam;
+ if (ppFlsSlots == NULL)
+ goto l_InvalidParam;
- SetLastError(0);
- pRetVal = ppFlsSlots[dwFlsIndex + 2];
+ SetLastError(0);
+ pRetVal = ppFlsSlots[dwFlsIndex + 2];
- return pRetVal;
+ return pRetVal;
l_InvalidParam:
- SetLastError(ERROR_INVALID_PARAMETER);
- return NULL;
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return NULL;
}
/*
* @implemented
*/
-BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
+BOOL
+WINAPI
+FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
{
- PVOID * ppFlsSlots;
- TEB * pTeb = NtCurrentTeb();
+ PVOID *ppFlsSlots;
+ TEB *pTeb = NtCurrentTeb();
- if(dwFlsIndex >= 128) goto l_InvalidParam;
+ if (dwFlsIndex >= 128)
+ goto l_InvalidParam;
- ppFlsSlots = pTeb->FlsData;
+ ppFlsSlots = pTeb->FlsData;
- if(ppFlsSlots == NULL)
- {
- PEB * pPeb = pTeb->ProcessEnvironmentBlock;
+ if (ppFlsSlots == NULL)
+ {
+ PEB *pPeb = pTeb->ProcessEnvironmentBlock;
- ppFlsSlots = RtlAllocateHeap
- (
- pPeb->ProcessHeap,
- HEAP_ZERO_MEMORY,
- (128 + 2) * sizeof(PVOID)
- );
+ 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;
- pTeb->FlsData = ppFlsSlots;
+ RtlAcquirePebLock();
- RtlAcquirePebLock();
+ /* TODO: initialization */
- /* TODO: initialization */
+ RtlReleasePebLock();
+ }
- RtlReleasePebLock();
- }
+ ppFlsSlots[dwFlsIndex + 2] = lpFlsData;
- ppFlsSlots[dwFlsIndex + 2] = lpFlsData;
-
- return TRUE;
+ return TRUE;
l_OutOfMemory:
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- goto l_Fail;
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ goto l_Fail;
l_InvalidParam:
- SetLastError(ERROR_INVALID_PARAMETER);
+ SetLastError(ERROR_INVALID_PARAMETER);
l_Fail:
- return FALSE;
+ return FALSE;
}
/* EOF */
Modified: trunk/reactos/dll/win32/kernel32/thread/tls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/thread/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/thread/tls.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/thread/tls.c [iso-8859-1] Sat Jan 9 21:51:33 2010
@@ -82,7 +82,7 @@
TlsFree(DWORD Index)
{
BOOL BitSet;
-
+
if (Index >= TLS_EXPANSION_SLOTS + TLS_MINIMUM_AVAILABLE)
{
SetLastErrorByStatus(STATUS_INVALID_PARAMETER);