[KERNEL32]: Changes to proc.c:

- ReadProcessMemory/WriteProcessMemory only write to *lpNumberOfBytesRead/Written if user-mode passed in the parameter, as its an optional argument in Win32, but not in NT. Instead, use a local variable. This means that anyone calling ReadProcessMemory/WriteProcessMemory in ReactOS before with a NULL output argument (totally valid) was getting an error before!
- WriteProcessMemory actually returns STATUS_ACCESS_VIOLATION in a few cases, even if it's defined as a BOOL function. Code on Google shows major applications depending on this, which we weren't doing.
- Rewrite InitCommandLines to be much simpler. No normalization or copying or ANSi/OEM logic is needed.
- GetProcessAffinityMask should use the BaseStaticServerData from CSRSS instead of querying system information each time.
- GetProcessShutdownParameters and SetProcessShutdownParameters should use the LPC status code from CSRSS, not the LPC API status code.
- GetProcessWorkingSetSize now calls GetProcessWorkingSetSizeEx.
- Implement GetProcessWorkingSetSizeEx.
- SetProcessWorkingSetSize now calls SetProcessWorkingSetSizeEx.
- Implement SetProcessWorkingSetSizeEx.
- Acquire the required privilege in SetProcessWorkingSetSize(Ex).
- Fail with correct status code in SetProcessWorkingSetSize(Ex).
- GetExitCodeProcess should check if this is a VDM process and get the exit code that way.
- GetStartupInfoW should not fail if the input is NULL. It should crash.
- GetStartupInfoW was not filling out the lpReserved field, which should contain the ShellInfo buffer.
- GetStartupInfoW was always setting standard handles -- it should not do so if those are console handles.
- GetStartupInfoA was not thread-safe.
- GetStartupInfoA was assuming all Unicode->ANSI conversions will be successful.
- GetStartupInfoA was not filling out lpReserved either.
- ExitProcess was not using SEH and was not using the PEB lock.
- TerminateProcess was not setting ERROR_INVALID_HANDLE last error code.
- FatalAppExitA was not using static TEB buffer, and was always assuming success.
- FatalAppExitW was doing some sort of bizarre hack. It now raises as a hard error as it should.
- FatalExit now displays a debugger input interface on checked builds, just like Windows.
- SetPriorityClass now tries to acquire the real time privilege when needed, and handles failure to do so.
- GetProcessVersion rewritten to be cleaner and simpler.
- Annotate and reformat functions where needed.
- Rename lpfnGlobalRegisterWaitForInputIdle to UserWaitForInputIdleRoutine
- GetProcessPriorityBoost is now BOOL-safe.
- IsWow64Process now sets NT error code using only one API.
- CommandLineStringA/W -> BaseAnsiCommandLine/BaseUnicodeCommandLine.


svn path=/trunk/; revision=55092
This commit is contained in:
Alex Ionescu
2012-01-23 04:57:12 +00:00
parent 51a64982dd
commit 08b2762e84
4 changed files with 636 additions and 500 deletions
+2 -2
View File
@@ -1026,9 +1026,9 @@ LoadModule(LPCSTR lpModuleName,
}
/* Wait up to 30 seconds for the process to become idle */
if (lpfnGlobalRegisterWaitForInputIdle)
if (UserWaitForInputIdleRoutine)
{
lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess, 30000);
UserWaitForInputIdleRoutine(ProcessInformation.hProcess, 30000);
}
/* Close handles */
File diff suppressed because it is too large Load Diff
@@ -158,7 +158,7 @@ DWORD
extern BOOLEAN InWindows;
extern WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle;
extern WaitForInputIdleType UserWaitForInputIdleRoutine;
/* GLOBAL VARIABLES **********************************************************/
@@ -493,6 +493,13 @@ BaseMarkFileForDelete(
IN ULONG FileAttributes
);
BOOL
WINAPI
BaseCheckForVDM(
IN HANDLE ProcessHandle,
OUT LPDWORD ExitCode
);
/* FIXME: This is EXPORTED! It should go in an external kernel32.h header */
VOID
WINAPI
+2 -1
View File
@@ -127,9 +127,10 @@ extern ULONG NTSYSAPI NtBuildNumber;
#define PROFILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | PROFILE_CONTROL)
//
// Maximum Parameters for NtRaiseHardError
// NtRaiseHardError-related parameters
//
#define MAXIMUM_HARDERROR_PARAMETERS 4
#define HARDERROR_OVERRIDE_ERRORMODE 0x10000000
//
// Pushlock bits