mirror of
https://github.com/reactos/reactos.git
synced 2024-11-19 05:22:59 +00:00
- Implement support for DEBUG_PROCESS in CreateProcess so that processes can be started with a debugger (works and tested with a new test app).
- We still seem to be suffering from a bug during certain debug event waits. svn path=/trunk/; revision=25004
This commit is contained in:
parent
7909b7a822
commit
3851db2429
2 changed files with 34 additions and 5 deletions
|
@ -642,7 +642,7 @@ CreateProcessInternalW(HANDLE hToken,
|
|||
UNICODE_STRING ApplicationName = {0};
|
||||
OBJECT_ATTRIBUTES LocalObjectAttributes;
|
||||
POBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE hSection = NULL, hProcess = NULL, hThread = NULL;
|
||||
HANDLE hSection = NULL, hProcess = NULL, hThread = NULL, hDebug = NULL;
|
||||
SECTION_IMAGE_INFORMATION SectionImageInfo;
|
||||
LPWSTR CurrentDirectory = NULL;
|
||||
LPWSTR CurrentDirectoryPart;
|
||||
|
@ -1101,7 +1101,7 @@ GetAppName:
|
|||
}
|
||||
|
||||
/* FIXME: Check for Debugger */
|
||||
|
||||
|
||||
/* FIXME: Check if Machine Type and SubSys Version Match */
|
||||
|
||||
/* We don't support POSIX or anything else for now */
|
||||
|
@ -1124,7 +1124,35 @@ GetAppName:
|
|||
ObjectAttributes = BasepConvertObjectAttributes(&LocalObjectAttributes,
|
||||
lpProcessAttributes,
|
||||
NULL);
|
||||
|
||||
|
||||
/* Check if we're going to be debugged */
|
||||
if (dwCreationFlags & DEBUG_PROCESS)
|
||||
{
|
||||
/* FIXME: Set process flag */
|
||||
}
|
||||
|
||||
/* Check if we're going to be debugged */
|
||||
if (dwCreationFlags & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS))
|
||||
{
|
||||
/* Connect to DbgUi */
|
||||
Status = DbgUiConnectToDbg();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to connect to DbgUI!\n");
|
||||
SetLastErrorByStatus(Status);
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Get the debug object */
|
||||
hDebug = DbgUiGetThreadDebugObject();
|
||||
|
||||
/* Check if only this process will be debugged */
|
||||
if (dwCreationFlags & DEBUG_ONLY_THIS_PROCESS)
|
||||
{
|
||||
/* FIXME: Set process flag */
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the Process */
|
||||
Status = NtCreateProcess(&hProcess,
|
||||
PROCESS_ALL_ACCESS,
|
||||
|
@ -1132,7 +1160,7 @@ GetAppName:
|
|||
NtCurrentProcess(),
|
||||
bInheritHandles,
|
||||
hSection,
|
||||
NULL,
|
||||
hDebug,
|
||||
NULL);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -329,6 +329,7 @@ DbgkForwardException(IN PEXCEPTION_RECORD ExceptionRecord,
|
|||
PAGED_CODE();
|
||||
DBGKTRACE(DBGK_EXCEPTION_DEBUG,
|
||||
"ExceptionRecord: %p Port: %p\n", ExceptionRecord, DebugPort);
|
||||
KEBUGCHECK(0);
|
||||
|
||||
/* Setup the API Message */
|
||||
ApiMessage.h.u1.Length = sizeof(DBGKM_MSG) << 16 |
|
||||
|
@ -339,7 +340,7 @@ DbgkForwardException(IN PEXCEPTION_RECORD ExceptionRecord,
|
|||
/* Check if this is to be sent on the debug port */
|
||||
if (DebugPort)
|
||||
{
|
||||
/* Use the debug port, onless the thread is being hidden */
|
||||
/* Use the debug port, unless the thread is being hidden */
|
||||
Port = PsGetCurrentThread()->HideFromDebugger ?
|
||||
NULL : Process->DebugPort;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue