Switch back to the command prompt when you press the "X" Close button

svn path=/trunk/; revision=4256
This commit is contained in:
Gé van Geldorp 2003-03-06 23:57:03 +00:00
parent 18e402c803
commit ddf2e52b15
12 changed files with 467 additions and 337 deletions

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.27 2003/03/04 13:19:01 rcampbell Exp $ /* $Id: defwnd.c,v 1.28 2003/03/06 23:57:00 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -550,11 +550,16 @@ DefWndHitTestNC(HWND hWnd, POINT Point)
if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW)) if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW))
{ {
WindowRect.left += GetSystemMetrics(SM_CXSIZE); WindowRect.left += GetSystemMetrics(SM_CXSIZE);
WindowRect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
} }
if (Point.x <= WindowRect.left) if (Point.x <= WindowRect.left)
{ {
return(HTSYSMENU); return(HTSYSMENU);
} }
if (WindowRect.right <= Point.x)
{
return(HTCLOSE);
}
if (Style & WS_MAXIMIZEBOX) if (Style & WS_MAXIMIZEBOX)
{ {
@ -774,6 +779,7 @@ DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
SendMessageA(hWnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam); SendMessageA(hWnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam);
break; break;
} }
return(0); return(0);
} }
@ -784,6 +790,19 @@ DefWndHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
return(0); return(0);
} }
LRESULT
DefWndHandleLButtonUpNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
switch (wParam)
{
case HTCLOSE:
SendMessageA(hWnd, WM_CLOSE, 0, 0);
break;
}
return(0);
}
LRESULT LRESULT
DefWndHandleActiveNC(HWND hWnd, WPARAM wParam) DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
{ {
@ -978,6 +997,11 @@ User32DefWindowProc(HWND hWnd,
return(DefWndHandleLButtonDownNC(hWnd, wParam, lParam)); return(DefWndHandleLButtonDownNC(hWnd, wParam, lParam));
} }
case WM_NCLBUTTONUP:
{
return(DefWndHandleLButtonUpNC(hWnd, wParam, lParam));
}
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK: case WM_NCLBUTTONDBLCLK:
{ {

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.11 2002/09/17 23:46:23 dwelch Exp $ /* $Id: message.c,v 1.12 2003/03/06 23:57:00 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -309,6 +309,7 @@ STDCALL
PostQuitMessage( PostQuitMessage(
int nExitCode) int nExitCode)
{ {
(void) NtUserPostMessage(NULL, WM_QUIT, nExitCode, 0);
} }
WINBOOL WINBOOL

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.18 2003/03/06 21:03:49 gvg Exp $ /* $Id: window.c,v 1.19 2003/03/06 23:57:00 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -472,7 +472,10 @@ DeferWindowPos(HDWP hWinPosInfo,
WINBOOL STDCALL WINBOOL STDCALL
DestroyWindow(HWND hWnd) DestroyWindow(HWND hWnd)
{ {
return FALSE; SendMessageW(hWnd, WM_DESTROY, 0, 0);
SendMessageW(hWnd, WM_NCDESTROY, 0, 0);
return NtUserDestroyWindow(hWnd);
} }
WINBOOL STDCALL WINBOOL STDCALL

View file

@ -90,7 +90,7 @@
#include <internal/module.h> #include <internal/module.h>
#include <internal/ldr.h> #include <internal/ldr.h>
#define NDEBUG #undef NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
extern LIST_ENTRY PiThreadListHead; extern LIST_ENTRY PiThreadListHead;
@ -129,6 +129,8 @@ typedef struct _CPU_REGISTER
{ {
DWORD Size; DWORD Size;
DWORD OffsetInTF; DWORD OffsetInTF;
DWORD OffsetInContext;
BOOLEAN SetInContext;
} CPU_REGISTER, *PCPU_REGISTER; } CPU_REGISTER, *PCPU_REGISTER;
#define KTRAP_FRAME_X86 KTRAP_FRAME #define KTRAP_FRAME_X86 KTRAP_FRAME
@ -137,22 +139,22 @@ typedef struct _CPU_REGISTER
static CPU_REGISTER GspRegisters[NUMREGS] = static CPU_REGISTER GspRegisters[NUMREGS] =
{ {
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eax) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eax), FIELD_OFFSET (CONTEXT, Eax), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ecx) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ecx), FIELD_OFFSET (CONTEXT, Ecx), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Edx) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Edx), FIELD_OFFSET (CONTEXT, Edx), FALSE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ebx) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ebx), FIELD_OFFSET (CONTEXT, Ebx), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Esp) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Esp), FIELD_OFFSET (CONTEXT, Esp), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ebp) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ebp), FIELD_OFFSET (CONTEXT, Ebp), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Esi) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Esi), FIELD_OFFSET (CONTEXT, Esi), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Edi) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Edi), FIELD_OFFSET (CONTEXT, Edi), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eip) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eip), FIELD_OFFSET (CONTEXT, Eip), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eflags) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Eflags), FIELD_OFFSET (CONTEXT, EFlags), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Cs) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Cs), FIELD_OFFSET (CONTEXT, SegCs), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ss) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ss), FIELD_OFFSET (CONTEXT, SegSs), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ds) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Ds), FIELD_OFFSET (CONTEXT, SegDs), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Es) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Es), FIELD_OFFSET (CONTEXT, SegEs), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Fs) }, { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Fs), FIELD_OFFSET (CONTEXT, SegFs), TRUE },
{ 4, FIELD_OFFSET (KTRAP_FRAME_X86, Gs) } { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Gs), FIELD_OFFSET (CONTEXT, SegGs), TRUE }
}; };
static PCHAR GspThreadStates[THREAD_STATE_MAX] = static PCHAR GspThreadStates[THREAD_STATE_MAX] =
@ -349,46 +351,10 @@ GspPutPacketNoWait (PCHAR Buffer)
KdPutChar (HexChars[Checksum & 0xf]); KdPutChar (HexChars[Checksum & 0xf]);
} }
VOID
GspDebugError(LPSTR Message)
{
DbgPrint ("%s\n", Message);
}
/* Address of a routine to RTE to if we get a memory fault. */
static VOID (*volatile MemoryFaultRoutine) () = NULL;
/* Indicate to caller of GspMem2Hex or GspHex2Mem that there has been an /* Indicate to caller of GspMem2Hex or GspHex2Mem that there has been an
error. */ error. */
static volatile BOOLEAN GspMemoryError = FALSE; static volatile BOOLEAN GspMemoryError = FALSE;
static void *GspAccessLocation = NULL;
/* Currently not used */
VOID
GspSetMemoryError()
{
GspMemoryError = TRUE;
}
/* These are separate functions so that they are so short and sweet
that the compiler won't save any Registers (if there is a fault
to MemoryFaultRoutine, they won't get restored, so there better
not be any saved). */
CHAR
GspGetChar (PCHAR Address)
{
return *Address;
}
VOID
GspSetChar (PCHAR Address,
CHAR Value)
{
*Address = Value;
}
/* Convert the memory pointed to by Address into hex, placing result in Buffer */ /* Convert the memory pointed to by Address into hex, placing result in Buffer */
@ -404,19 +370,19 @@ GspMem2Hex (PCHAR Address,
ULONG i; ULONG i;
CHAR ch; CHAR ch;
if (MayFault)
MemoryFaultRoutine = GspSetMemoryError;
for (i = 0; i < (ULONG) Count; i++) for (i = 0; i < (ULONG) Count; i++)
{ {
ch = GspGetChar (Address++); if (MayFault)
GspAccessLocation = Address;
ch = *Address;
GspAccessLocation = NULL;
if (MayFault && GspMemoryError) if (MayFault && GspMemoryError)
return (Buffer); return (Buffer);
*Buffer++ = HexChars[(ch >> 4) & 0xf]; *Buffer++ = HexChars[(ch >> 4) & 0xf];
*Buffer++ = HexChars[ch & 0xf]; *Buffer++ = HexChars[ch & 0xf];
Address++;
} }
*Buffer = 0; *Buffer = 0;
if (MayFault)
MemoryFaultRoutine = NULL;
return (Buffer); return (Buffer);
} }
@ -429,21 +395,51 @@ GspHex2Mem (PCHAR Buffer,
ULONG Count, ULONG Count,
BOOLEAN MayFault) BOOLEAN MayFault)
{ {
PCHAR current;
PCHAR page;
ULONG countinpage;
ULONG i; ULONG i;
CHAR ch; CHAR ch;
ULONG oldprot;
current = Address;
while ( current < Address + Count )
{
page = (PCHAR)PAGE_ROUND_DOWN (current);
if (Address + Count <= page + PAGE_SIZE)
{
/* Fits in this page */
countinpage = Count;
}
else
{
/* Flows into next page, handle only current page in this iteration */
countinpage = PAGE_SIZE - (Address - page);
}
if (MayFault) if (MayFault)
MemoryFaultRoutine = GspSetMemoryError; {
for (i = 0; i < Count; i++) oldprot = MmGetPageProtect (NULL, Address);
MmSetPageProtect (NULL, Address, PAGE_EXECUTE_READWRITE);
}
for (i = 0; i < countinpage && ! GspMemoryError; i++)
{ {
ch = HexValue (*Buffer++) << 4; ch = HexValue (*Buffer++) << 4;
ch = ch + HexValue (*Buffer++); ch = ch + HexValue (*Buffer++);
GspSetChar (Address++, ch);
if (MayFault && GspMemoryError) GspAccessLocation = Address;
return (Buffer); *current = ch;
GspAccessLocation = NULL;
current++;
} }
if (MayFault) if (MayFault)
MemoryFaultRoutine = NULL; {
MmSetPageProtect (NULL, page, oldprot);
if (GspMemoryError)
return (Buffer);
}
}
return (Buffer); return (Buffer);
} }
@ -530,33 +526,51 @@ GspLong2Hex (PCHAR *Address,
{ {
LONG Save; LONG Save;
Save = (((Value >> 0) & 0xf) << 24) | Save = (((Value >> 0) & 0xff) << 24) |
(((Value >> 8) & 0xf) << 16) | (((Value >> 8) & 0xff) << 16) |
(((Value >> 16) & 0xf) << 8) | (((Value >> 16) & 0xff) << 8) |
(((Value >> 24) & 0xf) << 0); (((Value >> 24) & 0xff) << 0);
*Address = GspMem2Hex ((PCHAR) &Save, *Address, 4, FALSE); *Address = GspMem2Hex ((PCHAR) &Save, *Address, 4, FALSE);
} }
/*
* Esp is not stored in the trap frame, although there is a member with it's name.
* Instead, it was pointing to the location of the TrapFrame Esp member when the
* exception occured.
*/
static LONG
GspGetEspFromTrapFrame(PKTRAP_FRAME TrapFrame)
{
return (LONG) &TrapFrame->Esp;
}
VOID VOID
GspGetRegistersFromTrapFrame(PCHAR Address, GspGetRegistersFromTrapFrame(PCHAR Address,
PCONTEXT Context,
PKTRAP_FRAME TrapFrame) PKTRAP_FRAME TrapFrame)
{ {
PCPU_REGISTER Regs;
ULONG Value; ULONG Value;
PCHAR Buffer; PCHAR Buffer;
PULONG p; PULONG p;
DWORD i; DWORD i;
Buffer = Address; Buffer = Address;
Regs = &GspRegisters[0]; for (i = 0; i < sizeof (GspRegisters) / sizeof (GspRegisters[0]); i++)
for (i = 0; i < NUMREGS; i++)
{ {
if (TrapFrame) if (TrapFrame)
{ {
p = (PULONG) ((ULONG_PTR) TrapFrame + Regs[i].OffsetInTF); if (ESP == i)
{
Value = GspGetEspFromTrapFrame (TrapFrame);
}
else
{
p = (PULONG) ((ULONG_PTR) TrapFrame + GspRegisters[i].OffsetInTF);
Value = *p; Value = *p;
} }
}
else if (i == EIP_REGNO) else if (i == EIP_REGNO)
{ {
/* /*
@ -569,16 +583,16 @@ GspGetRegistersFromTrapFrame(PCHAR Address,
{ {
Value = 0; Value = 0;
} }
Buffer = GspMem2Hex ((PCHAR) &Value, Buffer, Regs[i].Size, FALSE); Buffer = GspMem2Hex ((PCHAR) &Value, Buffer, GspRegisters[i].Size, FALSE);
} }
} }
VOID VOID
GspSetRegistersInTrapFrame(PCHAR Address, GspSetRegistersInTrapFrame(PCHAR Address,
PCONTEXT Context,
PKTRAP_FRAME TrapFrame) PKTRAP_FRAME TrapFrame)
{ {
PCPU_REGISTER Regs;
ULONG Value; ULONG Value;
PCHAR Buffer; PCHAR Buffer;
PULONG p; PULONG p;
@ -588,12 +602,14 @@ GspSetRegistersInTrapFrame(PCHAR Address,
return; return;
Buffer = Address; Buffer = Address;
Regs = &GspRegisters[0];
for (i = 0; i < NUMREGS; i++) for (i = 0; i < NUMREGS; i++)
{ {
p = (PULONG) ((ULONG_PTR) TrapFrame + Regs[i].OffsetInTF); if (GspRegisters[i].SetInContext)
p = (PULONG) ((ULONG_PTR) Context + GspRegisters[i].OffsetInContext);
else
p = (PULONG) ((ULONG_PTR) TrapFrame + GspRegisters[i].OffsetInTF);
Value = 0; Value = 0;
Buffer = GspHex2Mem (Buffer, (PCHAR) &Value, Regs[i].Size, FALSE); Buffer = GspHex2Mem (Buffer, (PCHAR) &Value, GspRegisters[i].Size, FALSE);
*p = Value; *p = Value;
} }
} }
@ -602,6 +618,7 @@ GspSetRegistersInTrapFrame(PCHAR Address,
VOID VOID
GspSetSingleRegisterInTrapFrame(PCHAR Address, GspSetSingleRegisterInTrapFrame(PCHAR Address,
LONG Number, LONG Number,
PCONTEXT Context,
PKTRAP_FRAME TrapFrame) PKTRAP_FRAME TrapFrame)
{ {
ULONG Value; ULONG Value;
@ -610,6 +627,9 @@ GspSetSingleRegisterInTrapFrame(PCHAR Address,
if (!TrapFrame) if (!TrapFrame)
return; return;
if (GspRegisters[Number].SetInContext)
p = (PULONG) ((ULONG_PTR) Context + GspRegisters[Number].OffsetInContext);
else
p = (PULONG) ((ULONG_PTR) TrapFrame + GspRegisters[Number].OffsetInTF); p = (PULONG) ((ULONG_PTR) TrapFrame + GspRegisters[Number].OffsetInTF);
Value = 0; Value = 0;
GspHex2Mem (Address, (PCHAR) &Value, GspRegisters[Number].Size, FALSE); GspHex2Mem (Address, (PCHAR) &Value, GspRegisters[Number].Size, FALSE);
@ -706,7 +726,14 @@ GspQuery(PCHAR Request)
/* Get current thread id */ /* Get current thread id */
GspOutBuffer[0] = 'Q'; GspOutBuffer[0] = 'Q';
GspOutBuffer[1] = 'C'; GspOutBuffer[1] = 'C';
if (NULL != GspDbgThread)
{
Value = (ULONG) GspDbgThread->Cid.UniqueThread; Value = (ULONG) GspDbgThread->Cid.UniqueThread;
}
else
{
Value = (ULONG) PsGetCurrentThread()->Cid.UniqueThread;
}
GspLong2Hex (&ptr, Value); GspLong2Hex (&ptr, Value);
} }
else if (strncmp (Command, "fThreadInfo", 11) == 0) else if (strncmp (Command, "fThreadInfo", 11) == 0)
@ -719,6 +746,7 @@ GspQuery(PCHAR Request)
ETHREAD, Tcb.ThreadListEntry); ETHREAD, Tcb.ThreadListEntry);
Value = (ULONG) GspEnumThread->Cid.UniqueThread; Value = (ULONG) GspEnumThread->Cid.UniqueThread;
GspLong2Hex (&ptr, Value); GspLong2Hex (&ptr, Value);
DPRINT("fThreadInfo 0x%08x\n", (ULONG) GspEnumThread->Cid.UniqueThread);
} }
else if (strncmp (Command, "sThreadInfo", 11) == 0) else if (strncmp (Command, "sThreadInfo", 11) == 0)
{ {
@ -732,10 +760,12 @@ GspQuery(PCHAR Request)
GspOutBuffer[0] = 'm'; GspOutBuffer[0] = 'm';
Value = (ULONG) GspEnumThread->Cid.UniqueThread; Value = (ULONG) GspEnumThread->Cid.UniqueThread;
GspLong2Hex (&ptr, Value); GspLong2Hex (&ptr, Value);
DPRINT("sThreadInfo 0x%08x\n", (ULONG) GspEnumThread->Cid.UniqueThread);
} }
else else
{ {
GspOutBuffer[0] = '1'; GspOutBuffer[0] = 'l';
DPRINT("End of threads\n");
} }
} }
else if (strncmp (Command, "ThreadExtraInfo", 15) == 0) else if (strncmp (Command, "ThreadExtraInfo", 15) == 0)
@ -947,11 +977,22 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
LONG SigVal; LONG SigVal;
LONG NewPC; LONG NewPC;
PCHAR ptr; PCHAR ptr;
LONG Esp;
/* FIXME: Stop on other CPUs too */ /* FIXME: Stop on other CPUs too */
/* Disable hardware debugging while we are inside the stub */ /* Disable hardware debugging while we are inside the stub */
__asm__("movl %0,%%db7" : /* no output */ : "r" (0)); __asm__("movl %0,%%db7" : /* no output */ : "r" (0));
if (NULL != GspAccessLocation &&
(ULONG_PTR) GspAccessLocation ==
(ULONG_PTR) ExceptionRecord->ExceptionInformation[1])
{
GspAccessLocation = NULL;
GspMemoryError = TRUE;
TrapFrame->Eip += 2;
}
else
{
/* reply to host that an exception has occurred */ /* reply to host that an exception has occurred */
SigVal = GspComputeSignal (ExceptionRecord->ExceptionCode); SigVal = GspComputeSignal (ExceptionRecord->ExceptionCode);
@ -963,7 +1004,9 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
*ptr++ = HexChars[ESP]; *ptr++ = HexChars[ESP];
*ptr++ = ':'; *ptr++ = ':';
ptr = GspMem2Hex ((PCHAR) &TrapFrame->Esp, ptr, 4, 0); /* SP */
Esp = GspGetEspFromTrapFrame (TrapFrame); /* SP */
ptr = GspMem2Hex ((PCHAR) &Esp, ptr, 4, 0);
*ptr++ = ';'; *ptr++ = ';';
*ptr++ = HexChars[EBP]; *ptr++ = HexChars[EBP];
@ -1001,15 +1044,23 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
break; break;
case 'g': /* return the value of the CPU Registers */ case 'g': /* return the value of the CPU Registers */
if (GspDbgThread) if (GspDbgThread)
GspGetRegistersFromTrapFrame (&GspOutBuffer[0], GspDbgThread->Tcb.TrapFrame); {
DPRINT("GspDbgThread active\n");
GspGetRegistersFromTrapFrame (&GspOutBuffer[0], Context, GspDbgThread->Tcb.TrapFrame);
/*GspGetRegistersFromTrapFrame (&GspOutBuffer[0], Context, TrapFrame);*/
}
else else
GspGetRegistersFromTrapFrame (&GspOutBuffer[0], TrapFrame); {
DPRINT("GspDbgThread not active\n");
GspGetRegistersFromTrapFrame (&GspOutBuffer[0], Context, TrapFrame);
}
break; break;
case 'G': /* set the value of the CPU Registers - return OK */ case 'G': /* set the value of the CPU Registers - return OK */
if (GspDbgThread) if (GspDbgThread)
GspSetRegistersInTrapFrame (ptr, GspDbgThread->Tcb.TrapFrame); /* GspSetRegistersInTrapFrame (ptr, Context, GspDbgThread->Tcb.TrapFrame);*/
GspSetRegistersInTrapFrame (ptr, Context, TrapFrame);
else else
GspSetRegistersInTrapFrame (ptr, TrapFrame); GspSetRegistersInTrapFrame (ptr, Context, TrapFrame);
strcpy (GspOutBuffer, "OK"); strcpy (GspOutBuffer, "OK");
break; break;
case 'P': /* set the value of a single CPU register - return OK */ case 'P': /* set the value of a single CPU register - return OK */
@ -1020,10 +1071,11 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
if ((Register >= 0) && (Register < NUMREGS)) if ((Register >= 0) && (Register < NUMREGS))
{ {
if (GspDbgThread) if (GspDbgThread)
GspSetSingleRegisterInTrapFrame (ptr, Register, /* GspSetSingleRegisterInTrapFrame (ptr, Register,
GspDbgThread->Tcb.TrapFrame); Context, GspDbgThread->Tcb.TrapFrame);*/
GspSetSingleRegisterInTrapFrame (ptr, Register, Context, TrapFrame);
else else
GspSetSingleRegisterInTrapFrame (ptr, Register, TrapFrame); GspSetSingleRegisterInTrapFrame (ptr, Register, Context, TrapFrame);
strcpy (GspOutBuffer, "OK"); strcpy (GspOutBuffer, "OK");
break; break;
} }
@ -1045,14 +1097,12 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
if (GspMemoryError) if (GspMemoryError)
{ {
strcpy (GspOutBuffer, "E03"); strcpy (GspOutBuffer, "E03");
GspDebugError ("memory fault"); DPRINT ("Fault during memory read\n");
} }
} }
if (ptr) if (ptr)
{
strcpy (GspOutBuffer, "E01"); strcpy (GspOutBuffer, "E01");
}
break; break;
/* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
@ -1069,7 +1119,7 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
if (GspMemoryError) if (GspMemoryError)
{ {
strcpy (GspOutBuffer, "E03"); strcpy (GspOutBuffer, "E03");
GspDebugError ("memory fault"); DPRINT ("Fault during memory write\n");
} }
else else
{ {
@ -1079,9 +1129,7 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
ptr = NULL; ptr = NULL;
} }
if (ptr) if (ptr)
{
strcpy (GspOutBuffer, "E02"); strcpy (GspOutBuffer, "E02");
}
break; break;
/* cAA..AA Continue at address AA..AA(optional) */ /* cAA..AA Continue at address AA..AA(optional) */
@ -1128,19 +1176,24 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
return kdHandleException; return kdHandleException;
break; break;
} }
case 'k': /* kill the program */ case 'k': /* kill the program */
strcpy (GspOutBuffer, "OK"); strcpy (GspOutBuffer, "OK");
break; break;
/* kill the program */ /* kill the program */
case 'H': /* Set thread */ case 'H': /* Set thread */
GspSetThread (ptr); GspSetThread (ptr);
break; break;
case 'q': /* Query */ case 'q': /* Query */
GspQuery (ptr); GspQuery (ptr);
break; break;
case 'T': /* Query thread status */ case 'T': /* Query thread status */
GspQueryThreadStatus (ptr); GspQueryThreadStatus (ptr);
break; break;
case 'Y': case 'Y':
{ {
ULONG Number; ULONG Number;
@ -1165,8 +1218,9 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
strcpy (GspOutBuffer, "E"); strcpy (GspOutBuffer, "E");
} }
break; break;
/* Remove hardware breakpoint */
} }
/* Remove hardware breakpoint */
case 'y': case 'y':
{ {
ULONG Number; ULONG Number;
@ -1183,6 +1237,7 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
} }
break; break;
} }
default: default:
break; break;
} /* switch */ } /* switch */
@ -1190,6 +1245,7 @@ KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
/* reply to the request */ /* reply to the request */
GspPutPacket (&GspOutBuffer[0]); GspPutPacket (&GspOutBuffer[0]);
} }
}
return kdDoNotHandleException; return kdDoNotHandleException;
} }
@ -1253,7 +1309,8 @@ KdGdbStubInit(ULONG Phase)
GspInitialized = TRUE; GspInitialized = TRUE;
GspRunThread = PsGetCurrentThread(); GspRunThread = PsGetCurrentThread();
GspDbgThread = PsGetCurrentThread(); /* GspDbgThread = PsGetCurrentThread(); */
GspDbgThread = NULL;
GspEnumThread = NULL; GspEnumThread = NULL;
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C); DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: catch.c,v 1.28 2003/01/16 17:55:36 ekohl Exp $ /* $Id: catch.c,v 1.29 2003/03/06 23:57:02 gvg Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/catch.c * FILE: ntoskrnl/ke/catch.c
@ -147,7 +147,9 @@ KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
* If RtlpDispatchException() does not handle the exception then * If RtlpDispatchException() does not handle the exception then
* bugcheck * bugcheck
*/ */
#ifdef TODO
if (Value != ExceptionContinueExecution) if (Value != ExceptionContinueExecution)
#endif
{ {
KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED); KeBugCheck (KMODE_EXCEPTION_NOT_HANDLED);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: mouse.c,v 1.17 2003/02/15 19:16:33 gvg Exp $ /* $Id: mouse.c,v 1.18 2003/03/06 23:57:02 gvg Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -260,7 +260,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
} }
/* If the mouse moved then move the pointer. */ /* If the mouse moved then move the pointer. */
if (mouse_cx != 0 || mouse_cy != 0) if ((mouse_cx != 0 || mouse_cy != 0) && MouseEnabled)
{ {
mouse_x += mouse_cx; mouse_x += mouse_cx;
mouse_y += mouse_cy; mouse_y += mouse_cy;

View file

@ -7,7 +7,7 @@
VOID VOID
W32kGuiCheck(VOID); W32kGuiCheck(VOID);
VOID VOID
W32kGraphicsCheck(VOID); W32kGraphicsCheck(BOOL Create);
#endif /* __WIN32K_GUICHECK_H */ #endif /* __WIN32K_GUICHECK_H */

View file

@ -36,6 +36,8 @@ PDESKTOP_OBJECT
W32kGetActiveDesktop(VOID); W32kGetActiveDesktop(VOID);
VOID VOID
W32kInitializeDesktopGraphics(VOID); W32kInitializeDesktopGraphics(VOID);
VOID
W32kEndDesktopGraphics(VOID);
HDC HDC
W32kGetScreenDC(VOID); W32kGetScreenDC(VOID);

View file

@ -1,4 +1,4 @@
/* $Id: guicheck.c,v 1.9 2002/09/17 23:43:28 dwelch Exp $ /* $Id: guicheck.c,v 1.10 2003/03/06 23:57:03 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -34,14 +34,29 @@ static ULONG NrGuiApplicationsRunning = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
W32kGraphicsCheck(VOID) W32kGraphicsCheck(BOOL Create)
{ {
if (NrGuiApplicationsRunning == 0) if (Create)
{
if (0 == NrGuiApplicationsRunning)
{ {
W32kInitializeDesktopGraphics(); W32kInitializeDesktopGraphics();
} }
NrGuiApplicationsRunning++; NrGuiApplicationsRunning++;
} }
else
{
if (0 < NrGuiApplicationsRunning)
{
NrGuiApplicationsRunning--;
}
if (0 == NrGuiApplicationsRunning)
{
W32kEndDesktopGraphics();
}
}
}
VOID VOID
W32kGuiCheck(VOID) W32kGuiCheck(VOID)

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.11 2002/10/31 00:03:31 dwelch Exp $ /* $Id: message.c,v 1.12 2003/03/06 23:57:03 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -324,10 +324,24 @@ NtUserPostMessage(HWND hWnd,
UINT Msg, UINT Msg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{
PUSER_MESSAGE_QUEUE ThreadQueue;
if (WM_QUIT == Msg)
{
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
ThreadQueue->QuitPosted = TRUE;
ThreadQueue->QuitExitCode = wParam;
return TRUE;
}
else
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return 0; return FALSE;
}
} }
BOOL STDCALL BOOL STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.24 2003/03/06 21:03:49 gvg Exp $ /* $Id: window.c,v 1.25 2003/03/06 23:57:03 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -370,7 +370,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
/* Initialize gui state if necessary. */ /* Initialize gui state if necessary. */
W32kGuiCheck(); W32kGuiCheck();
W32kGraphicsCheck(); W32kGraphicsCheck(TRUE);
if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer)) if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer))
{ {
@ -645,7 +645,7 @@ NtUserDeferWindowPos(HDWP WinPosInfo,
BOOLEAN STDCALL BOOLEAN STDCALL
NtUserDestroyWindow(HWND Wnd) NtUserDestroyWindow(HWND Wnd)
{ {
UNIMPLEMENTED W32kGraphicsCheck(FALSE);
return 0; return 0;
} }

View file

@ -1,4 +1,4 @@
/* $Id: winsta.c,v 1.11 2002/10/31 00:03:31 dwelch Exp $ /* $Id: winsta.c,v 1.12 2003/03/06 23:57:03 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -847,6 +847,18 @@ W32kInitializeDesktopGraphics(VOID)
NtUserAcquireOrReleaseInputOwnership(FALSE); NtUserAcquireOrReleaseInputOwnership(FALSE);
} }
VOID
W32kEndDesktopGraphics(VOID)
{
NtUserAcquireOrReleaseInputOwnership(TRUE);
EnableMouse(FALSE);
if (NULL != ScreenDeviceContext)
{
W32kDeleteDC(ScreenDeviceContext);
ScreenDeviceContext = NULL;
}
}
HDC HDC
W32kGetScreenDC(VOID) W32kGetScreenDC(VOID)
{ {