Author: ion
Date: Thu Nov 30 23:46:48 2006
New Revision: 25005
URL: http://svn.reactos.org/svn/reactos?rev=25005&view=rev
Log:
- Fix a bug in DbgkCreateThread which wasn't saving the initial thread information in the right place. The process create event is now fully supported and properly returns the entrypoint of the application.
Modified:
trunk/reactos/ntoskrnl/dbgk/dbgkutil.c
Modified: trunk/reactos/ntoskrnl/dbgk/dbgkutil.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/dbgkutil.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/dbgk/dbgkutil.c (original)
+++ trunk/reactos/ntoskrnl/dbgk/dbgkutil.c Thu Nov 30 23:46:48 2006
@@ -178,8 +178,8 @@
if (!(ProcessFlags & PSF_CREATE_REPORTED_BIT))
{
/* Setup the information structure for the new thread */
- CreateThread->SubSystemKey = 0;
- CreateThread->StartAddress = NULL;
+ CreateProcess->InitialThread.SubSystemKey = 0;
+ CreateProcess->InitialThread.StartAddress = NULL;
/* And for the new process */
CreateProcess->SubSystemKey = 0;
@@ -194,10 +194,9 @@
if (NtHeader)
{
/* Fill out data from the header */
- CreateThread->StartAddress = (PVOID)((ULONG_PTR)NtHeader->
- OptionalHeader.ImageBase +
- NtHeader->OptionalHeader.
- AddressOfEntryPoint);
+ CreateProcess->InitialThread.StartAddress =
+ (PVOID)((ULONG_PTR)NtHeader->OptionalHeader.ImageBase +
+ NtHeader->OptionalHeader.AddressOfEntryPoint);
CreateProcess->DebugInfoFileOffset = NtHeader->FileHeader.
PointerToSymbolTable;
CreateProcess->DebugInfoSize = NtHeader->FileHeader.
Author: ion
Date: Thu Nov 30 23:37:21 2006
New Revision: 25004
URL: http://svn.reactos.org/svn/reactos?rev=25004&view=rev
Log:
- 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.
Modified:
trunk/reactos/dll/win32/kernel32/process/create.c
trunk/reactos/ntoskrnl/dbgk/debug.c
Modified: trunk/reactos/dll/win32/kernel32/process/create.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/process/create.c (original)
+++ trunk/reactos/dll/win32/kernel32/process/create.c Thu Nov 30 23:37:21 2006
@@ -642,7 +642,7 @@
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 @@
}
/* 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 @@
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 @@
NtCurrentProcess(),
bInheritHandles,
hSection,
- NULL,
+ hDebug,
NULL);
if(!NT_SUCCESS(Status))
{
Modified: trunk/reactos/ntoskrnl/dbgk/debug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/debug.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/dbgk/debug.c (original)
+++ trunk/reactos/ntoskrnl/dbgk/debug.c Thu Nov 30 23:37:21 2006
@@ -329,6 +329,7 @@
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 @@
/* 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;
}
Author: ion
Date: Thu Nov 30 22:52:49 2006
New Revision: 25003
URL: http://svn.reactos.org/svn/reactos?rev=25003&view=rev
Log:
- Properly set and check the image notification flag for the process in DbgkCreateThread. Patch by hto.
See issue #1879 for more details.
Modified:
trunk/reactos/ntoskrnl/dbgk/dbgkutil.c
trunk/reactos/ntoskrnl/tests/TestDebug.c
Modified: trunk/reactos/ntoskrnl/dbgk/dbgkutil.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/dbgkutil.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/dbgk/dbgkutil.c (original)
+++ trunk/reactos/ntoskrnl/dbgk/dbgkutil.c Thu Nov 30 22:52:49 2006
@@ -104,10 +104,12 @@
PTEB Teb;
PAGED_CODE();
- /* Check if this process has already been notified */
- ProcessFlags = InterlockedAnd((PLONG)&Process->Flags,
- PSF_CREATE_REPORTED_BIT |
- PSF_IMAGE_NOTIFY_DONE_BIT);
+ /* Try ORing in the create reported and image notify flags */
+ ProcessFlags = InterlockedOr((PLONG)&Process->Flags,
+ PSF_CREATE_REPORTED_BIT |
+ PSF_IMAGE_NOTIFY_DONE_BIT);
+
+ /* Check if we were the first to set them or if another thread raced us */
if (!(ProcessFlags & PSF_IMAGE_NOTIFY_DONE_BIT) && (PsImageNotifyEnabled))
{
/* It hasn't.. set up the image info for the process */
Modified: trunk/reactos/ntoskrnl/tests/TestDebug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/tests/TestDebug.c…
==============================================================================
--- trunk/reactos/ntoskrnl/tests/TestDebug.c (original)
+++ trunk/reactos/ntoskrnl/tests/TestDebug.c Thu Nov 30 22:52:49 2006
@@ -49,7 +49,7 @@
&ClientId);
Status = DbgUiDebugActiveProcess(hProcess);
#else
- Error = DebugActiveProcess(2648);
+ Error = DebugActiveProcess(168);
#endif
#if NATIVE