-merge from head 16828-17390 -misc Modified: branches/win32k rewrite attempt/win32k/include/desktop.h Deleted: branches/win32k rewrite attempt/win32k/include/focus.h Deleted: branches/win32k rewrite attempt/win32k/include/input.h Deleted: branches/win32k rewrite attempt/win32k/include/keyboard.h Modified: branches/win32k rewrite attempt/win32k/include/msgqueue.h Deleted: branches/win32k rewrite attempt/win32k/include/painting.h Modified: branches/win32k rewrite attempt/win32k/include/userfuncs.h Deleted: branches/win32k rewrite attempt/win32k/include/vis.h Modified: branches/win32k rewrite attempt/win32k/include/win32k.h Modified: branches/win32k rewrite attempt/win32k/misc/copy.c Modified: branches/win32k rewrite attempt/win32k/ntuser/csr.c Modified: branches/win32k rewrite attempt/win32k/ntuser/desktop.c Modified: branches/win32k rewrite attempt/win32k/ntuser/focus.c Modified: branches/win32k rewrite attempt/win32k/ntuser/input.c Modified: branches/win32k rewrite attempt/win32k/ntuser/keyboard.c Modified: branches/win32k rewrite attempt/win32k/ntuser/misc.c Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c Modified: branches/win32k rewrite attempt/win32k/ntuser/painting.c Modified: branches/win32k rewrite attempt/win32k/ntuser/winpos.c Modified: branches/win32k rewrite attempt/win32k/ntuser/winsta.c Modified: branches/win32k rewrite attempt/win32k/objects/cliprgn.c Modified: branches/win32k rewrite attempt/win32k/objects/fillshap.c Modified: branches/win32k rewrite attempt/win32k/objects/rect.c Modified: branches/win32k rewrite attempt/win32k/objects/region.c Modified: branches/win32k rewrite attempt/win32k/tests/stubs.xml Modified: branches/win32k rewrite attempt/win32k/tests/tests/DIB_24BPP_ColorFill-performance.c _____
Modified: branches/win32k rewrite attempt/win32k/include/desktop.h --- branches/win32k rewrite attempt/win32k/include/desktop.h 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/include/desktop.h 2005-08-16 00:27:39 UTC (rev 17409) @@ -16,7 +16,7 @@
/* Pointer to the associated window station. */ struct _WINSTATION_OBJECT *WindowStation; /* Pointer to the active queue. */ - PUSER_MESSAGE_QUEUE ActiveQueue; +// PUSER_MESSAGE_QUEUE ActiveQueue; /* Rectangle of the work area */ RECT WorkArea; /* Handle of the desktop window. */ _____
Deleted: branches/win32k rewrite attempt/win32k/include/focus.h --- branches/win32k rewrite attempt/win32k/include/focus.h 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/include/focus.h 2005-08-16 00:27:39 UTC (rev 17409) @@ -1,5 +0,0 @@
-#ifndef _WIN32K_FOCUS_H -#define _WIN32K_FOCUS_H - - -#endif /* _WIN32K_FOCUS_H */ _____
Deleted: branches/win32k rewrite attempt/win32k/include/input.h --- branches/win32k rewrite attempt/win32k/include/input.h 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/include/input.h 2005-08-16 00:27:39 UTC (rev 17409) @@ -1,5 +0,0 @@
-#ifndef _WIN32K_INPUT_H -#define _WIN32K_INPUT_H - - -#endif /* _WIN32K_INPUT_H */ _____
Deleted: branches/win32k rewrite attempt/win32k/include/keyboard.h Property changes on: branches/win32k rewrite attempt/win32k/include/mmcopy.h ___________________________________________________________________ Name: svn:eol-style + native _____
Modified: branches/win32k rewrite attempt/win32k/include/msgqueue.h --- branches/win32k rewrite attempt/win32k/include/msgqueue.h 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/include/msgqueue.h 2005-08-16 00:27:39 UTC (rev 17409) @@ -79,7 +79,7 @@
/* Caret information for this queue */ THRDCARETINFO CaretInfo; /* Desktop that the message queue is attached to */ - struct _DESKTOP_OBJECT* Desktop; +// struct _DESKTOP_OBJECT* Desktop;
} USER_THREAD_INPUT, *PUSER_THREAD_INPUT;
_____
Deleted: branches/win32k rewrite attempt/win32k/include/painting.h
_____
Modified: branches/win32k rewrite attempt/win32k/include/userfuncs.h
--- branches/win32k rewrite attempt/win32k/include/userfuncs.h 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/include/userfuncs.h 2005-08-16 00:27:39 UTC (rev 17409) @@ -64,11 +64,11 @@
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID);
-PUSER_MESSAGE_QUEUE FASTCALL -UserGetFocusQueue(VOID);
+//PUSER_MESSAGE_QUEUE FASTCALL +//UserGetFocusQueue(VOID);
-VOID FASTCALL -IntSetFocusQueue(PUSER_MESSAGE_QUEUE Thread);
+//VOID FASTCALL +//IntSetFocusQueue(PUSER_MESSAGE_QUEUE Thread);
PDESKTOP_OBJECT FASTCALL UserGetActiveDesktop(VOID); @@ -128,6 +128,8 @@
PUSER_THREAD_INPUT create_thread_input( PW32THREAD thread ); inline VOID FASTCALL UserDereferenceInput(PUSER_THREAD_INPUT Input);
+inline PW32THREAD FASTCALL UserWThreadFromTid(DWORD tid); +
NTSTATUS FASTCALL InitInputImpl(VOID); NTSTATUS FASTCALL @@ -148,6 +150,11 @@
/******************** FOCUS.C ********************************/
+inline PUSER_MESSAGE_QUEUE FASTCALL UserGetForegroundQueue(); + +inline VOID FASTCALL UserSetForegroundQueue(PUSER_MESSAGE_QUEUE Queue); + +
/* * These functions take the window handles from current message queue. */
_____
Deleted: branches/win32k rewrite attempt/win32k/include/vis.h Property changes on: branches/win32k rewrite attempt/win32k/include/win32.h ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native
_____
Modified: branches/win32k rewrite attempt/win32k/include/win32k.h --- branches/win32k rewrite attempt/win32k/include/win32k.h 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/include/win32k.h 2005-08-16 00:27:39 UTC (rev 17409) @@ -26,11 +26,9 @@
#include <include/dib.h> #include <include/eng.h> #include <include/error.h>
-#include <include/focus.h>
#include <include/guicheck.h> #include <include/hook.h> #include <include/hotkey.h>
-#include <include/input.h>
#include <include/inteng.h> #include <include/intgdi.h> #include <include/intddraw.h> @@ -53,7 +51,6 @@
#include <include/winpos.h> #include <include/winsta.h> #include <include/mmcopy.h>
-#include <include/keyboard.h>
#include <eng/objects.h> #include <eng/misc.h> #include <dib/dib.h> Property changes on: branches/win32k rewrite attempt/win32k/include/win32k.h ___________________________________________________________________ Name: svn:eol-style + native
_____
Modified: branches/win32k rewrite attempt/win32k/misc/copy.c --- branches/win32k rewrite attempt/win32k/misc/copy.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/misc/copy.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -1,27 +1,27 @@
-#include "w32k.h" - -NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ) { - NTSTATUS Status = STATUS_SUCCESS; - - _SEH_TRY { - ProbeForRead(Source,Bytes,1); - RtlCopyMemory(Target,Source,Bytes); - } _SEH_HANDLE { - Status = _SEH_GetExceptionCode(); - } _SEH_END; - - return Status; -} - -NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ) { - NTSTATUS Status = STATUS_SUCCESS; - - _SEH_TRY { - ProbeForWrite(Target,Bytes,1); - RtlCopyMemory(Target,Source,Bytes); - } _SEH_HANDLE { - Status = _SEH_GetExceptionCode(); - } _SEH_END; - - return Status; -}
+#include "w32k.h" + +NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ) { + NTSTATUS Status = STATUS_SUCCESS; + + _SEH_TRY { + ProbeForRead(Source,Bytes,1); + RtlCopyMemory(Target,Source,Bytes); + } _SEH_HANDLE { + Status = _SEH_GetExceptionCode(); + } _SEH_END; + + return Status; +} + +NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ) { + NTSTATUS Status = STATUS_SUCCESS; + + _SEH_TRY { + ProbeForWrite(Target,Bytes,1); + RtlCopyMemory(Target,Source,Bytes); + } _SEH_HANDLE { + Status = _SEH_GetExceptionCode(); + } _SEH_END; + + return Status; +}
Property changes on: branches/win32k rewrite attempt/win32k/misc/copy.c ___________________________________________________________________ Name: svn:eol-style + native
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/csr.c --- branches/win32k rewrite attempt/win32k/ntuser/csr.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/csr.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -54,8 +54,8 @@
return STATUS_INVALID_PORT_HANDLE; }
- Request->Header.DataSize = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; - Request->Header.MessageSize = sizeof(CSR_API_MESSAGE);
+ Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE; + Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
/* Switch to the process in which the WindowsApiPort handle is valid */ OldProcess = PsGetCurrentProcess();
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/desktop.c --- branches/win32k rewrite attempt/win32k/ntuser/desktop.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/desktop.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -250,13 +250,13 @@
NULL, NULL);
- Status = ObOpenObjectByName(&ObjectAttributes, - ExWindowStationObjectType, - NULL, - UserMode, - 0, - NULL, - (HANDLE*)hWinSta);
+ Status = ObOpenObjectByName(&ObjectAttributes, + ExWindowStationObjectType, + NULL, + KernelMode, + 0, + NULL, + (HANDLE*)hWinSta);
RtlFreeUnicodeString(&FullName);
@@ -287,7 +287,7 @@
Status = ObOpenObjectByName(&ObjectAttributes, ExDesktopObjectType, NULL,
- UserMode,
+ KernelMode,
0, NULL, (HANDLE*)hDesktop); @@ -427,13 +427,14 @@
return Ret; }
+#if 0
PUSER_MESSAGE_QUEUE FASTCALL UserGetFocusQueue(VOID) { PDESKTOP_OBJECT pdo = UserGetActiveDesktop(); if (!pdo) {
- DPRINT("No active desktop\n");
+ DPRINT1("No active desktop\n");
return(NULL); } return pdo->ActiveQueue; @@ -446,7 +447,7 @@
PDESKTOP_OBJECT pdo = UserGetActiveDesktop(); if (!pdo) {
- DPRINT("No active desktop\n");
+ DPRINT1("No active desktop\n");
return; } if(NewQueue) @@ -479,6 +480,8 @@
// } }
+#endif +
PWINDOW_OBJECT FASTCALL UserGetDesktopWindow(VOID) { PDESKTOP_OBJECT pdo = UserGetActiveDesktop(); @@ -811,7 +814,7 @@
* Try to open already existing desktop */
- DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
+ DPRINT1("Trying to open desktop (%wZ)\n", &DesktopName);
/* Initialize ObjectAttributes for the desktop object */ InitializeObjectAttributes( @@ -821,14 +824,14 @@
NULL, NULL);
- Status = ObOpenObjectByName( - &ObjectAttributes, - ExDesktopObjectType, - NULL, - UserMode, - dwDesiredAccess, - NULL, - (HANDLE*)&Desktop);
+ Status = ObOpenObjectByName( + &ObjectAttributes, + ExDesktopObjectType, + NULL, + KernelMode, + dwDesiredAccess, + NULL, + (HANDLE*)&Desktop);
if (NT_SUCCESS(Status)) { @@ -868,7 +871,7 @@
IntGetDesktopWorkArea(DesktopObject, NULL);
/* Initialize some local (to win32k) desktop state. */
- DesktopObject->ActiveQueue = NULL;
+// DesktopObject->ActiveQueue = NULL;
Status = ObInsertObject( (PVOID)DesktopObject,
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/focus.c --- branches/win32k rewrite attempt/win32k/ntuser/focus.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/focus.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -19,22 +19,50 @@
* $Id$ */
+/* INCLUDES ******************************************************************/ +
#include <w32k.h>
#define NDEBUG #include <debug.h>
+ +/* GLOBALS *******************************************************************/ + +/* +Only the interactive WinSta can recieve input. This means +there can exist only one foreground window/queue/thread per +session. But its possibly that this variable should be in +the WinSta anyways. -Gunnar +*/ +PUSER_MESSAGE_QUEUE gForegroundQueue = NULL; + + +/* FUNCTIONS *****************************************************************/ + + +inline PUSER_MESSAGE_QUEUE FASTCALL UserGetForegroundQueue() +{ + return gForegroundQueue; +} + +inline VOID FASTCALL UserSetForegroundQueue(PUSER_MESSAGE_QUEUE Queue) +{ + gForegroundQueue = Queue; +} + +
PWINDOW_OBJECT FASTCALL UserGetCaptureWindow() {
- PUSER_MESSAGE_QUEUE ForegroundQueue = UserGetFocusQueue();
+ PUSER_MESSAGE_QUEUE ForegroundQueue = UserGetForegroundQueue();
return ForegroundQueue ? GetWnd(ForegroundQueue->Input->hCaptureWindow) : 0; }
PWINDOW_OBJECT FASTCALL UserGetFocusWindow() {
- PUSER_MESSAGE_QUEUE ForegroundQueue = UserGetFocusQueue();
+ PUSER_MESSAGE_QUEUE ForegroundQueue = UserGetForegroundQueue();
return ForegroundQueue ? GetWnd(ForegroundQueue->Input->hFocusWindow) : 0; }
@@ -164,7 +192,7 @@
return FALSE; }
- PrevForegroundQueue = UserGetFocusQueue();
+ PrevForegroundQueue = UserGetForegroundQueue();
if (PrevForegroundQueue != 0) { //FIXME uhm... focus er ikke samme som active window... er UserGetFocusMessageQueue riktig? @@ -185,7 +213,8 @@
IntSendDeactivateMessages(hWndPrev, hWnd); IntSendKillFocusMessages(GetWnd(hWndFocusPrev), GetWnd(hWndFocus));
- IntSetFocusQueue(Window->Queue);
+ UserSetForegroundQueue(Window->Queue); +
if (Window->Queue->Input) { Window->Queue->Input->hActiveWindow = hWnd; @@ -344,8 +373,7 @@
PWINDOW_OBJECT FASTCALL UserGetForegroundWindow(VOID) {
- PUSER_MESSAGE_QUEUE ForegroundQueue = UserGetFocusQueue(); -
+ PUSER_MESSAGE_QUEUE ForegroundQueue = UserGetForegroundQueue();
if (ForegroundQueue && ForegroundQueue->Input->hActiveWindow) return IntGetWindowObject(ForegroundQueue->Input->hActiveWindow);
@@ -422,7 +450,7 @@
Queue = UserGetCurrentQueue();
- /* window must be attached to queue input */
+ /* window must be attached to input queue */
if (Window->Queue->Input != Queue->Input) { SetLastWin32Error(ERROR_ACCESS_DENIED);
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/input.c --- branches/win32k rewrite attempt/win32k/ntuser/input.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/input.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -37,6 +37,7 @@
extern BYTE QueueKeyStateTable[];
+
/* GLOBALS *******************************************************************/
static HANDLE MouseDeviceHandle; @@ -49,6 +50,7 @@
static BOOLEAN InputThreadsRunning = FALSE; PUSER_MESSAGE_QUEUE pmPrimitiveQueue = NULL;
+
/* FUNCTIONS *****************************************************************/
#define ClearMouseInput(mi) \ @@ -498,19 +500,19 @@
DPRINT("KeyRaw: %s %04x\n", (KeyInput.Flags & KEY_BREAK) ? "up" : "down", KeyInput.MakeCode );
-
+CHECKPOINT1;
if (Status == STATUS_ALERTED && !InputThreadsRunning) break;
-
+CHECKPOINT1;
if (!NT_SUCCESS(Status)) { DPRINT1("Win32K: Failed to read from keyboard.\n"); return; //(Status); }
-
+CHECKPOINT1;
/* Update modifier state */ fsModifiers = IntKeyboardGetModifiers(&KeyInput);
-
+CHECKPOINT1;
if (fsModifiers) { if (KeyInput.Flags & KEY_BREAK) @@ -544,7 +546,7 @@
DPRINT("KeyRaw: %s %04x\n", (NextKeyInput.Flags & KEY_BREAK) ? "up":"down", NextKeyInput.MakeCode );
-
+CHECKPOINT1;
if (Status == STATUS_ALERTED && !InputThreadsRunning) goto KeyboardEscape;
@@ -554,7 +556,7 @@
* code. I'm not caring about the counting, not sure * if that matters. I think not. */
-
+CHECKPOINT1;
/* If the ModifierState is now empty again, send a * special notification and eat both keypresses */ @@ -572,17 +574,17 @@
IntKeyboardSendAltKeyMsg(); continue; }
-
+CHECKPOINT1;
NumKeys = 2; } } }
-
+CHECKPOINT1;
for (;NumKeys;memcpy(&KeyInput, &NextKeyInput, sizeof(KeyInput)), NumKeys--) { lParam = 0;
-
+CHECKPOINT1;
IntKeyboardUpdateLeds(KeyboardDeviceHandle, &KeyInput, IndicatorTrans); @@ -649,25 +651,29 @@
else msg.message = WM_KEYUP; }
-
+CHECKPOINT1;
/* Find the target thread whose locale is in effect */
- if (!IntGetScreenDC())
+ if (!IntGetScreenDC()){ + CHECKPOINT1;
FocusQueue = W32kGetPrimitiveQueue();
- else - FocusQueue = UserGetFocusQueue(); -
+ } + else{ + CHECKPOINT1; + FocusQueue = UserGetForegroundQueue(); + } +CHECKPOINT1;
/* This might cause us to lose hot keys, which are important * (ctrl-alt-del secure attention sequence). Not sure if it * can happen though. */ if (!FocusQueue) continue;
-
+CHECKPOINT1;
msg.lParam = lParam; msg.hwnd = FocusQueue->Input->hFocusWindow;
-
+CHECKPOINT1;
if (!QUEUE_2_WTHREAD(FocusQueue)->KeyboardLayout) continue;
-
+CHECKPOINT1;
/* This function uses lParam to fill wParam according to the * keyboard layout in use. */ @@ -675,14 +681,14 @@
QUEUE_2_WTHREAD(FocusQueue)->KeyboardLayout, KeyInput.Flags & KEY_E0 ? 0xE0 : (KeyInput.Flags & KEY_E1 ? 0xE1 : 0));
-
+CHECKPOINT1;
if (GetHotKey(InputWindowStation, ModifierState, msg.wParam, &Thread, &hWnd, &id))
- {
+ {CHECKPOINT1;
if (!(KeyInput.Flags & KEY_BREAK)) { DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id); @@ -694,7 +700,7 @@
} continue; /* Eat key up motion too */ }
-
+CHECKPOINT1;
/* * Post a keyboard message. */ @@ -1258,7 +1264,8 @@
//if (!(Input->Desktop = get_thread_desktop( thread, 0 /* FIXME: access rights */ )))
//FIXME: hack!
- Input->Desktop = thread->Desktop;
+ //FIXME: ros use this for focus queue stuff! WRONG!! +//FIXME Input->Desktop = thread->Desktop;
#if 0 //FIXME: this often fail bcause often thread->desktop is NULL
@@ -1307,7 +1314,7 @@
Desktop = thread_from->Desktop;
//input = (struct thread_input *)grab_object( thread_to->queue->input );
-
+#if 0
if (Input->Desktop != Desktop) { SetLastWin32Error( STATUS_ACCESS_DENIED ); @@ -1315,7 +1322,7 @@
// ObDereferenceObject( Desktop ); return FALSE; }
-
+#endif
// ObDereferenceObject( desktop );
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/keyboard.c --- branches/win32k rewrite attempt/win32k/ntuser/keyboard.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/keyboard.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -1210,8 +1210,8 @@
if(vkPtr->wch[CapsState] == wChar) { CapsMod = KeyLayout->pCharModifiers->ModNumber[CapsState];
- DPRINT("nMod %d Vk %04x: CapsMod %08x CapsState %08x MaxModBits %08x\n", - nMod, vkPtr->VirtualKey, CapsMod, CapsState, KeyLayout->pCharModifiers->wMaxModBits);
+ DPRINT("nMod %d wC %04x: CapsMod %08x CapsState %08x MaxModBits %08x\n", + nMod, wChar, CapsMod, CapsState, KeyLayout->pCharModifiers->wMaxModBits);
return ((CapsMod << 8)|(vkPtr->VirtualKey & 0xff)); } }
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/misc.c --- branches/win32k rewrite attempt/win32k/ntuser/misc.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/misc.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -754,6 +754,9 @@
}
+/* + * @unimplemented + */
HWND STDCALL NtUserCallHwndOpt( @@ -763,15 +766,23 @@
switch (Routine) { case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
- /* FIXME */
+ /* + * FIXME + * Nothing too hard...validate the hWnd and save it in the Desktop Info + */ + DPRINT1("HWNDOPT_ROUTINE_SETPROGMANWINDOW UNIMPLEMENTED\n");
break;
case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
- /* FIXME */
+ /* + * FIXME + * Nothing too hard...validate the hWnd and save it in the Desktop Info + */ + DPRINT1("HWNDOPT_ROUTINE_SETTASKMANWINDOW UNIMPLEMENTED\n");
break; }
- return 0;
+ return Param;
}
/* @@ -1272,17 +1283,15 @@
BOOL STDCALL NtUserGetGUIThreadInfo(
- DWORD idThread, /* if NULL use foreground thread */
+ DWORD tid, /* if NULL use foreground thread */
LPGUITHREADINFO lpgui) { NTSTATUS Status;
- PTHRDCARETINFO CaretInfo;
GUITHREADINFO SafeGui;
- PDESKTOP_OBJECT Desktop; - PUSER_MESSAGE_QUEUE MsgQueue; - PUSER_THREAD_INPUT Input; - PETHREAD Thread = NULL;
+ + PUSER_MESSAGE_QUEUE Queue;
DECLARE_RETURN(BOOLEAN);
+ PW32THREAD WThread = NULL;
DPRINT("Enter NtUserGetGUIThreadInfo\n"); UserEnterExclusive(); @@ -1300,65 +1309,53 @@
RETURN( FALSE); }
- if(idThread)
+ if(tid)
{
- Status = PsLookupThreadByThreadId((HANDLE)idThread, &Thread); - if(!NT_SUCCESS(Status))
+ WThread = UserWThreadFromTid(tid); + if(!WThread)
{ SetLastWin32Error(ERROR_ACCESS_DENIED); RETURN( FALSE); }
- Desktop = Thread->Tcb.Win32Thread->Desktop;
+ Queue = &WThread->Queue;
} else { /* get the foreground thread */
- //FIXME: interactive_Winsta->Active_desktop->active_thread - PW32THREAD W32Thread = PsGetWin32Thread(); - - if(W32Thread) - { - Desktop = W32Thread->Desktop; - MsgQueue = Desktop->ActiveQueue;//huh??? - Thread = QUEUE_2_WTHREAD(MsgQueue)->Thread; - }
+ Queue = UserGetForegroundQueue();
}
- if(!Thread || !Desktop)
+ if (Queue && Queue->Input)
{
- if(idThread && Thread) - ObDereferenceObject(Thread); - SetLastWin32Error(ERROR_ACCESS_DENIED); - RETURN( FALSE); - }
+ SafeGui.flags = (Queue->Input->CaretInfo.Visible ? GUI_CARETBLINKING : 0); + if(Queue->Input->hMenuOwner) + SafeGui.flags |= GUI_INMENUMODE | Queue->MenuState; + if(Queue->Input->hMoveSize) + SafeGui.flags |= GUI_INMOVESIZE;
- MsgQueue = Desktop->ActiveQueue; - Input = MsgQueue->Input; - CaretInfo = &Input->CaretInfo;
+ /* FIXME add flag GUI_16BITTASK */
- SafeGui.flags = (CaretInfo->Visible ? GUI_CARETBLINKING : 0); - if(Input->hMenuOwner) - SafeGui.flags |= GUI_INMENUMODE | MsgQueue->MenuState; - if(Input->hMoveSize) - SafeGui.flags |= GUI_INMOVESIZE;
+ SafeGui.hwndActive = Queue->Input->hActiveWindow; + SafeGui.hwndFocus = Queue->Input->hFocusWindow; + SafeGui.hwndCapture = Queue->Input->hCaptureWindow; + SafeGui.hwndMenuOwner = Queue->Input->hMenuOwner; + SafeGui.hwndMoveSize = Queue->Input->hMoveSize; + SafeGui.hwndCaret = Queue->Input->CaretInfo.hWnd;
- /* FIXME add flag GUI_16BITTASK */
+ SafeGui.rcCaret.left = Queue->Input->CaretInfo.Pos.x; + SafeGui.rcCaret.top = Queue->Input->CaretInfo.Pos.y; + SafeGui.rcCaret.right = SafeGui.rcCaret.left + Queue->Input->CaretInfo.Size.cx; + SafeGui.rcCaret.bottom = SafeGui.rcCaret.top + Queue->Input->CaretInfo.Size.cy; + } + else + { + //FIXME: maybe we should just fail in case no Input exist? */ + RtlZeroMemory(&SafeGui, sizeof(GUITHREADINFO)); + } + + if(WThread) + ObDereferenceObject(WThread->Thread);
- SafeGui.hwndActive = Input->hActiveWindow; - SafeGui.hwndFocus = Input->hFocusWindow; - SafeGui.hwndCapture = Input->hCaptureWindow; - SafeGui.hwndMenuOwner = Input->hMenuOwner; - SafeGui.hwndMoveSize = Input->hMoveSize; - SafeGui.hwndCaret = CaretInfo->hWnd; - - SafeGui.rcCaret.left = CaretInfo->Pos.x; - SafeGui.rcCaret.top = CaretInfo->Pos.y; - SafeGui.rcCaret.right = SafeGui.rcCaret.left + CaretInfo->Size.cx; - SafeGui.rcCaret.bottom = SafeGui.rcCaret.top + CaretInfo->Size.cy; - - if(idThread) - ObDereferenceObject(Thread); -
Status = MmCopyToCaller(lpgui, &SafeGui, sizeof(GUITHREADINFO)); if(!NT_SUCCESS(Status)) {
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c --- branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -654,7 +654,7 @@
VOID FASTCALL MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) {
- PUSER_MESSAGE_QUEUE FocusQueue;
+ PUSER_MESSAGE_QUEUE ForegroundQueue;
MSG Msg; LARGE_INTEGER LargeTickCount; KBDLLHOOKSTRUCT KbdHookData; @@ -686,7 +686,7 @@
return; }
- FocusQueue = UserGetFocusQueue();
+ ForegroundQueue = UserGetForegroundQueue();
/* * FIXME: whats the point of this call???? -- Gunnar @@ -710,22 +710,19 @@
} else {
- if (FocusQueue == NULL)
+ if (ForegroundQueue == NULL)
{
- DPRINT("No focus message queue\n");
+ DPRINT("No foreground message queue\n");
return; }
- if (FocusQueue->Input->hFocusWindow != (HWND)0)
+ if (ForegroundQueue->Input->hFocusWindow)
{
- Msg.hwnd = FocusQueue->Input->hFocusWindow; -// DPRINT("Msg.hwnd = %x\n", Msg.hwnd); -// DPRINT("FocusMessageQueue %x\n", FocusMessageQueue); -// DPRINT("FocusMessageQueue->Desktop %x\n", FocusMessageQueue->Desktop); -// DPRINT("FocusMessageQueue->Desktop->WindowStation %x\n", FocusMessageQueue->Desktop->WindowStation); - //FIXME: fikk crash her , inval mem 0x0000001c - UserGetCursorLocation(FocusQueue->Input->Desktop->WindowStation, &Msg.pt); - MsqPostMessage(FocusQueue, &Msg, FALSE, QS_KEY);
+ Msg.hwnd = ForegroundQueue->Input->hFocusWindow; + + //FIXME: what does this do??? + UserGetCursorLocation(NULL, &Msg.pt); + MsqPostMessage(ForegroundQueue, &Msg, FALSE, QS_KEY);
} else { @@ -1508,7 +1505,7 @@
#endif
-/* called when the thread is destroyed */
+/* called when the wthread is destroyed */
VOID FASTCALL MsqDestroyMessageQueue(PW32THREAD WThread) { @@ -1518,10 +1515,14 @@
/* remove the message queue from any desktops */ //FIXME: queue->desktop? what about thread->hDesktop?? why both?
- if (Queue->Input->Desktop)
+// if (Queue->Input->Desktop) +// { +// Queue->Input->Desktop->ActiveQueue = NULL; +// Queue->Input->Desktop = NULL; +// } + if (Queue == UserGetForegroundQueue())
{
- Queue->Input->Desktop->ActiveQueue = NULL; - Queue->Input->Desktop = NULL;
+ UserSetForegroundQueue(NULL);
}
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/painting.c --- branches/win32k rewrite attempt/win32k/ntuser/painting.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/painting.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -628,17 +628,22 @@
}
HWND FASTCALL
-IntFixCaret(HWND hWnd, LPRECT lprc, UINT flags)
+IntFixCaret(PWINDOW_OBJECT Wnd, LPRECT lprc, UINT flags)
{
- PDESKTOP_OBJECT Desktop;
PTHRDCARETINFO CaretInfo;
+ PUSER_THREAD_INPUT Input;
HWND hWndCaret;
- Desktop = PsGetWin32Thread()->Desktop; - CaretInfo = &Desktop->ActiveQueue->Input->CaretInfo; - hWndCaret = CaretInfo->hWnd; - if (hWndCaret == hWnd || - ((flags & SW_SCROLLCHILDREN) && UserIsChildWindow(GetWnd(hWnd), GetWnd(hWndCaret))))
+ ASSERT(Wnd); + + Input = UserGetCurrentQueue()->Input; + if (!Input) return 0; //FIXME: can it be NULL?? + if (!Input->CaretInfo.hWnd) return 0; + + hWndCaret = Input->CaretInfo.hWnd; + + if (hWndCaret == Wnd->hSelf || + ((flags & SW_SCROLLCHILDREN) && UserIsChildWindow(Wnd, GetWnd(hWndCaret))))
{ POINT pt, FromOffset, ToOffset, Offset; RECT rcCaret; @@ -646,7 +651,7 @@
pt.x = CaretInfo->Pos.x; pt.y = CaretInfo->Pos.y; UserGetClientOrigin(GetWnd(hWndCaret), &FromOffset);
- UserGetClientOrigin(GetWnd(hWnd), &ToOffset);
+ UserGetClientOrigin(Wnd, &ToOffset);
Offset.x = FromOffset.x - ToOffset.x; Offset.y = FromOffset.y - ToOffset.y; rcCaret.left = pt.x; @@ -1271,7 +1276,7 @@
}
caretrc = rc;
- hwndCaret = IntFixCaret(hWnd, &caretrc, flags);
+ hwndCaret = IntFixCaret(Window, &caretrc, flags);
if (hrgnUpdate) bOwnRgn = FALSE;
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/winpos.c --- branches/win32k rewrite attempt/win32k/ntuser/winpos.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/winpos.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -118,7 +118,7 @@
if (!Window || IntIsDesktopWindow(Window)) {
- IntSetFocusQueue(NULL);
+ UserSetForegroundQueue(NULL);
return; }
_____
Modified: branches/win32k rewrite attempt/win32k/ntuser/winsta.c --- branches/win32k rewrite attempt/win32k/ntuser/winsta.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/ntuser/winsta.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -469,7 +469,7 @@
&ObjectAttributes, ExWindowStationObjectType, NULL,
- UserMode,
+ KernelMode,
dwDesiredAccess, NULL, (PVOID*)&WindowStation);
_____
Modified: branches/win32k rewrite attempt/win32k/objects/cliprgn.c --- branches/win32k rewrite attempt/win32k/objects/cliprgn.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/objects/cliprgn.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -187,7 +187,7 @@
LPRECT rc) { int Ret;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
RECT Saferect;
Ret = IntGdiGetClipBox(hDC, &Saferect); @@ -327,8 +327,28 @@
int XOffset, int YOffset) {
- UNIMPLEMENTED; - return 0;
+ INT Result; + DC *dc; + + if(!(dc = DC_LockDc(hDC))) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return ERROR; + } + + if(dc->w.hClipRgn != NULL) + { + Result = NtGdiOffsetRgn(dc->w.hClipRgn, + XOffset, + YOffset); + } + else + { + Result = NULLREGION; + } + + DC_UnlockDc(dc); + return Result;
}
BOOL STDCALL NtGdiPtVisible(HDC hDC,
_____
Modified: branches/win32k rewrite attempt/win32k/objects/fillshap.c --- branches/win32k rewrite attempt/win32k/objects/fillshap.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/objects/fillshap.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -925,7 +925,7 @@
DC *dc; LPPOINT Safept; LPINT SafePolyPoints;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
BOOL Ret;
dc = DC_LockDc(hDC);
_____
Modified: branches/win32k rewrite attempt/win32k/objects/rect.c --- branches/win32k rewrite attempt/win32k/objects/rect.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/objects/rect.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -70,7 +70,7 @@
BOOL STDCALL NtGdiIsEmptyRect(const RECT* UnsafeRect) {
- RECT Rect;
+ RECT Rect = {0};
NTSTATUS Status = STATUS_SUCCESS;
_SEH_TRY
_____
Modified: branches/win32k rewrite attempt/win32k/objects/region.c --- branches/win32k rewrite attempt/win32k/objects/region.c 2005-08-16 00:01:42 UTC (rev 17408) +++ branches/win32k rewrite attempt/win32k/objects/region.c 2005-08-16 00:27:39 UTC (rev 17409) @@ -2028,7 +2028,7 @@
STDCALL NtGdiCreateEllipticRgnIndirect(CONST PRECT Rect) {
- RECT SafeRect;
[truncated at 1000 lines; 87 more skipped]