mostly structural changes (reorg). nothing really fixed and hopefully
nothing broken
Added: branches/win32k rewrite attempt/win32k/docs/winsta and
desktops.txt
Modified: branches/win32k rewrite attempt/win32k/include/accelerator.h
Deleted: branches/win32k rewrite attempt/win32k/include/callback.h
Deleted: branches/win32k rewrite attempt/win32k/include/clipboard.h
Modified: branches/win32k rewrite attempt/win32k/include/cursoricon.h
Modified: branches/win32k rewrite attempt/win32k/include/desktop.h
Deleted: branches/win32k rewrite attempt/win32k/include/guicheck.h
Modified: branches/win32k rewrite attempt/win32k/include/hook.h
Modified: branches/win32k rewrite attempt/win32k/include/hotkey.h
Modified: branches/win32k rewrite attempt/win32k/include/menu.h
Modified: branches/win32k rewrite attempt/win32k/include/monitor.h
Modified: branches/win32k rewrite attempt/win32k/include/ntuser.h
Modified: branches/win32k rewrite attempt/win32k/include/object.h
Modified: branches/win32k rewrite attempt/win32k/include/scroll.h
Deleted: branches/win32k rewrite attempt/win32k/include/useratom.h
Modified: branches/win32k rewrite attempt/win32k/include/userfuncs.h
Modified: branches/win32k rewrite attempt/win32k/include/win32.h
Modified: branches/win32k rewrite attempt/win32k/include/win32k.h
Modified: branches/win32k rewrite attempt/win32k/include/window.h
Modified: branches/win32k rewrite attempt/win32k/include/winpos.h
Modified: branches/win32k rewrite attempt/win32k/include/winsta.h
Modified: branches/win32k rewrite attempt/win32k/main/dllmain.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/accelerator.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/callback.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/caret.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/cursoricon.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/guicheck.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/handle.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/hook.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/hotkey.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/input.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/menu.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/message.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/misc.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/monitor.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/ntuser.c
Added: branches/win32k rewrite attempt/win32k/ntuser/object.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/painting.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/prop.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/scrollbar.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/vis.c
Modified: branches/win32k rewrite attempt/win32k/ntuser/window.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/color.c
Modified: branches/win32k rewrite attempt/win32k/objects/dc.c
Modified: branches/win32k rewrite attempt/win32k/win32k.xml
_____
Added: branches/win32k rewrite attempt/win32k/docs/winsta and
desktops.txt
--- branches/win32k rewrite attempt/win32k/docs/winsta and desktops.txt
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/docs/winsta and desktops.txt
2005-08-29 14:24:38 UTC (rev 17590)
@@ -0,0 +1,156 @@
+SAWinSta
+--------
+I write a GUI appication, and the user may run it in task schedule.
Since
+windows 2000/XP treat schedule task as a service, the schedule service
can
+not be associated with interactive desktop object in the in 2 states
+1) No user log on
+2) Log on with another account.
+I write a test program, and find when the schedule service starts, the
+station/desktop will be "SAWinSta\Desktop" in both cases
+
+Is there any way to let schedule service associated with interactive
desktop
+in these 2 cases?
+
+thanks
+-------------------------------------------
+
+Service-0x0-3e7$
+----------------
+By default Win32 services associated with non-visible windows station
(for
+services which run in the local system account it is Service-0x0-3e7$)
and they
+can't (without using special flag MB_SERVICE_NOTIFICATION or
+MB_DEFAULT_DESKTOP_ONLY in the MessageBox function) interact with user.
+However, you may configure a service to have GUI capabilities. Just set
Type
+field of the registry service entry equal SERVICE_INTERACTIVE_PROCESS.
When
+this key is specified SCM will connect the service with WinSta0 instead
+Service-0x0-3e7$ and it will alow to display windows and dialog boxes.
+
+-------------------------------------------------
+
+WinSta0
+-------
+
+-The one-and-only interactive WinSta.
+-No other winsta can be visible/active.
+-Only WinSta0 can recieve input.
+-All other WinSta's are invisible/non-interactive WinStas.
+
+What good is a invisible WinSta? Its used for running services in thus
services cant
+interact with the user.
+
+There are limits to what u can do in a invisible WinSta.
+-Bitblt wont work for instance, since nothing is really displayed in a
invisible WinSta (to save resources).
+ No point in using GDI resources for stuff noone can see.
+-SendInput wont work
+
+
+
+---------------------------------------------------
+ MORE INFORMATION
+
+A Window station can either be interactive or noninteractive. (At the
moment on Windows NT 3.51 and 4.0, only "Winsta0" can be an interactive
Window station.) Any Desktops created on the interactive Window station
will have the ability to become active. An active Desktop encompasses
the ability for user objects (such as windows and dialog boxes) created
on the Desktop to be visible to the interactively logged-on user (that
is, the user who logs on the system via CTRL-ALT-DELETE) and receive
user input.
+
+When the interactively logged-on user launches any processes, these
processes are associated with the "default" Desktop in the "Winsta0"
Window station. The "default" Desktop is considered the active Desktop.
A process on the active Desktop could switch Desktops such that another
Desktop becomes the active Desktop such as the "Winlogon" Desktop. Only
one Desktop can be the active Desktop at any one time.
+
+Desktops associated with a noninteractive Window station can create
user objects. These objects will never be visible to the interactively
logged-on user and will never receive any user input. If you have a
noninteractive Service running in the LocalSystem account, any user
objects created by the service will not be visible to the interactively
logged-on user. In addition, any processes launched by the service will
also not be visible.
+If our desktop has the same name as the active one, we are running on
the
+active (input) desktop. This is true because desktops have exactly one
+name each, and within a window station, desktop names must be unique
+----------------------------------------------------------------
+
+Process closing window station with CloseWindowStation can't be
assigned to the window station
+ it is closing.
+
+
+The reason is that each session has its own CSRSS, as well as instanced
+win32k.sys data. So in each session, you basically have a complete
copy of
+Windows that doesn't know about the existance of any other copy.
You're not
+just on a different desktop/windowstation when you're in a different
+session.
+
+
+Lawrence, you are wrong. HWNDs are valid throughout the whole
+windowstation, not only the creating process. That's because they
+are pointers, but not in your address space...
+
+
+The CreateDesktop function creates a new desktop on the window station
associated with the calling process.
+
+PROCESS:
+-every w32 process is associated with a WindowStation
+-can move between window stations (well, with strict limitations i
would guess eg. what if
+ windows have been created and is using the winsta heap? or can
multiple winsta heaps be mapped into
+ one process?? )
+
+THREADS:
+-can only enumerate windows on its desktop (but u can easely switch to
a different desk)
+-every w32 thread is associated with a Desktop
+-Threads can switch between desktops, and windows are created on the
thread's current desktop
+ (a thread can have windows on multiple desktops? IS THIS REALLY TRUE?)
+
+DESKTOP:
+-owns windows
+-Only one desktop at a time can interact with the user, and that
desktop must necessarily
+be associated with Winsta0
+-Only one desktop is visible to the user and only one can receives
input at any time
+-contain a logical display surface
+-contin windows (or a pointer to the desktop window)
+-contain menus
+-contain hooks
+-holds UI objects, such as windows, menus, and hooks
+-Once a window is created it cannot move between desktops
+
+SESSION:
+-session = win32k instance
+-Every session contains one or more windows stations
+-A given login session has only one window station with access to user
interactions
+(term server has multiple login sessions)
+-each logon session is associated with a window station
+
+WINDOW STATION:
+-only Winsta0 has access to the display
+-Only one window station, called Winsta0, can interact with the user
display, keyboard, mouse
+-is a secure object
+-Only the interactive window station WinSta0, can display
+ output or receive input. Other window stations are used by "services"
+ (but cant u switch winsta?? so a noninteractive winsta becomes
active?)
+-contains a set of global atoms
+-contains a clipboard
+-contains a set of desktop objects
+-contains handle table(s) (handles are valid throughout the whole
windowstation, not only the creating process)
+-contain heaps (pointer(s) to the section heap(s) shared between
user32/gdi32/win32k)
+-A Windows 2000 session will have several windows stations, one
assigned to the logon session
+ of the interactive user, and others assigned to the Winlogon process,
the secure screen saver
+ process, and any service that runs in a security context other than
that of the interactive user.
+
+ The interactive window station assigned to the logon session of the
interactive user also contains
+ the keyboard, mouse, and display device. The interactive window
station is visible to the user and
+ can receive input from the user. All other window stations are
noninteractive, which means that
+ they cannot be made visible to the user, and cannot receive user
input.
+
+WINDOWS
+-is owned by a desktop
+-windows are tied to the window station where they started
+-u cant move windows between desktops either
+
+The system associates a desktop with a thread when that thread is
created
+The desktop associated with a thread must be on the window station
associated with the thread's process.
+A thread can use the SetThreadDesktop function to change its desktop.
+The GetThreadDesktop function retrieves a handle to the desktop
associated with a specified thread.
+
+The calling process must have an associated window station, either
assigned by the system at process creation time or set by
SetProcessWindowStation. A desktop is a secure object contained within a
window station object.
+
+
+There can be several window stations in the system but only one of them
can
+be the interactive window station. That is the only windowstation whose
+processes can communicate with the user (it has a visible desktop and
can
+receive mouse and keyboard input). A desktop lives inside a
windowstation
+and provides a display to the user. Only one desktop can be the active
+desktop for a particular windowstation at any time. Furthermore only a
+desktop that lives inside the interactive windowstation and is the
currently
+active desktop for that windowstation is visible to the user. On your
+average Windows NT system there are at least 3 desktops inside the
+interactive windowstation: the 'shell', winlogon and the screensaver.
Each
+process that runs on your system (and hence services as well) run
inside a
+windowstation and each thread in that process runs in the same
windowstation
+but can run in a different desktop.
_____
Modified: branches/win32k rewrite attempt/win32k/include/accelerator.h
--- branches/win32k rewrite attempt/win32k/include/accelerator.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/accelerator.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -6,17 +6,22 @@
typedef struct _ACCELERATOR_TABLE
{
- int Count;
- LPACCEL Table;
-} ACCELERATOR_TABLE, *PACCELERATOR_TABLE;
+ union
+ {
+ USER_OBJECT_HDR hdr;
+ struct
+ {
+ /*---------- USER_OBJECT_HDR --------------*/
+ HACCEL hSelf; /* want typesafe handle */
+ LONG refs_placeholder;
+ BYTE flags_placeholder;
+ /*---------- USER_OBJECT_HDR --------------*/
-NTSTATUS FASTCALL
-InitAcceleratorImpl();
+ int Count;
+ LPACCEL Table;
+ };
-NTSTATUS FASTCALL
-CleanupAcceleratorImpl();
+ };
+} ACCELERATOR_TABLE, *PACCELERATOR_TABLE;
-VOID
-RegisterThreadAcceleratorTable(struct _ETHREAD *Thread);
-
#endif /* _WIN32K_ACCELERATOR_H */
_____
Deleted: branches/win32k rewrite attempt/win32k/include/callback.h
--- branches/win32k rewrite attempt/win32k/include/callback.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/callback.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -1,45 +0,0 @@
-#ifndef _WIN32K_CALLBACK_H
-#define _WIN32K_CALLBACK_H
-
-LRESULT STDCALL
-IntCallWindowProc(WNDPROC Proc,
- BOOLEAN IsAnsiProc,
- HWND Wnd,
- UINT Message,
- WPARAM wParam,
- LPARAM lParam,
- INT lParamBufferSize);
-
-VOID STDCALL
-IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
- HWND hWnd,
- UINT Msg,
- ULONG_PTR CompletionCallbackContext,
- LRESULT Result);
-
-
-HMENU STDCALL
-IntLoadSysMenuTemplate();
-
-BOOL STDCALL
-IntLoadDefaultCursors(VOID);
-
-LRESULT STDCALL
-IntCallHookProc(INT HookId,
- INT Code,
- WPARAM wParam,
- LPARAM lParam,
- HOOKPROC Proc,
- BOOLEAN Ansi,
- PUNICODE_STRING ModuleName);
-
-VOID FASTCALL
-IntCleanupThreadCallbacks(PW32THREAD W32Thread);
-
-PVOID FASTCALL
-IntCbAllocateMemory(ULONG Size);
-
-VOID FASTCALL
-IntCbFreeMemory(PVOID Data);
-
-#endif /* _WIN32K_CALLBACK_H */
_____
Deleted: branches/win32k rewrite attempt/win32k/include/clipboard.h
--- branches/win32k rewrite attempt/win32k/include/clipboard.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/clipboard.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -1,7 +0,0 @@
-#ifndef _WIN32K_CLIPBOARD_H
-#define _WIN32K_CLIPBOARD_H
-
-UINT FASTCALL
-IntEnumClipboardFormats(UINT format);
-
-#endif /* _WIN32K_CLIPBOARD_H */
_____
Modified: branches/win32k rewrite attempt/win32k/include/cursoricon.h
--- branches/win32k rewrite attempt/win32k/include/cursoricon.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/cursoricon.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -11,15 +11,27 @@
typedef struct _CURICON_OBJECT
{
- LIST_ENTRY ListEntry;
- HANDLE Self;
- LIST_ENTRY ProcessList;
- HMODULE hModule;
- HRSRC hRsrc;
- HRSRC hGroupRsrc;
- SIZE Size;
- BYTE Shadow;
- ICONINFO IconInfo;
+ union
+ {
+ USER_OBJECT_HDR hdr;
+ struct
+ {
+ /*---------- USER_OBJECT_HDR --------------*/
+ HCURSOR hSelf; /* want typesafe handle */
+ LONG refs_placeholder;
+ BYTE flags_placeholder;
+ /*---------- USER_OBJECT_HDR --------------*/
+
+ LIST_ENTRY ListEntry;
+ LIST_ENTRY ProcessList;
+ HMODULE hModule;
+ HRSRC hRsrc;
+ HRSRC hGroupRsrc;
+ SIZE Size;
+ BYTE Shadow;
+ ICONINFO IconInfo;
+ };
+ };
} CURICON_OBJECT, *PCURICON_OBJECT;
typedef struct _CURSORCLIP_INFO
@@ -45,20 +57,10 @@
DWORD LastBtnDown;
LONG LastBtnDownX;
LONG LastBtnDownY;
- HANDLE LastClkWnd;
+ HANDLE LastClkWnd; //FIXME
} SYSTEM_CURSORINFO, *PSYSTEM_CURSORINFO;
-HCURSOR FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL
ForceChange);
-BOOL FASTCALL UserSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject);
-PCURICON_OBJECT FASTCALL UserCreateCurIconHandle(PWINSTATION_OBJECT
WinStaObject);
-VOID FASTCALL UserCleanupCurIcons(struct _EPROCESS *Process,
PW32PROCESS Win32Process);
-BOOL FASTCALL
-UserGetCursorLocation(PWINSTATION_OBJECT WinStaObject, POINT *loc);
-
-#define UserGetSysCursorInfo(WinStaObj) \
- (PSYSTEM_CURSORINFO)((WinStaObj)->SystemCursor)
-
#endif /* _WIN32K_CURSORICON_H */
/* EOF */
_____
Modified: branches/win32k rewrite attempt/win32k/include/desktop.h
--- branches/win32k rewrite attempt/win32k/include/desktop.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/desktop.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -10,18 +10,22 @@
CSHORT Type;
CSHORT Size;
+ /* entry in WinSta's list of desktops */
LIST_ENTRY ListEntry;
KSPIN_LOCK Lock;
+
+//FIXME: add desktop heap ptr/struct
+
UNICODE_STRING Name;
/* Pointer to the associated window station. */
- struct _WINSTATION_OBJECT *WindowStation;
+ struct _WINSTATION_OBJECT *WinSta;
/* 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. */
- HANDLE DesktopWindow;
- HANDLE PrevActiveWindow;
+ HWND DesktopWindow;
+ HWND PrevActiveWindow;
/* Thread blocking input */
PVOID BlockInputThread;
_____
Deleted: branches/win32k rewrite attempt/win32k/include/guicheck.h
--- branches/win32k rewrite attempt/win32k/include/guicheck.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/guicheck.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -1,14 +0,0 @@
-#ifndef _WIN32K_GUICHECK_H
-#define _WIN32K_GUICHECK_H
-
-BOOL FASTCALL IntCreatePrimarySurface();
-VOID FASTCALL IntDestroyPrimarySurface();
-
-NTSTATUS FASTCALL InitGuiCheckImpl (VOID);
-
-BOOL FASTCALL
-UserGraphicsCheck(BOOL Create);
-
-#endif /* _WIN32K_GUICHECK_H */
-
-/* EOF */
_____
Modified: branches/win32k rewrite attempt/win32k/include/hook.h
--- branches/win32k rewrite attempt/win32k/include/hook.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/hook.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -5,8 +5,13 @@
typedef struct tagHOOK
{
+/*---------- USER_OBJECT_HDR --------------*/
+ HHOOK hSelf;
+ LONG refs;
+ BYTE hdrFlags;
+/*---------- USER_OBJECT_HDR --------------*/
+
LIST_ENTRY Chain; /* Hook chain entry */
- HHOOK Self; /* user handle for this hook */
PETHREAD Thread; /* Thread owning the hook */
int HookId; /* Hook table index */
HOOKPROC Proc; /* Hook function */
@@ -23,8 +28,6 @@
UINT Counts[NB_HOOKS]; /* use counts for each hook chain */
} HOOKTABLE, *PHOOKTABLE;
-LRESULT FASTCALL HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam,
LPARAM lParam);
-VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread);
#endif /* _WIN32K_HOOK_H */
_____
Modified: branches/win32k rewrite attempt/win32k/include/hotkey.h
--- branches/win32k rewrite attempt/win32k/include/hotkey.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/hotkey.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -14,32 +14,7 @@
UINT vk;
} HOT_KEY_ITEM, *PHOT_KEY_ITEM;
-NTSTATUS FASTCALL
-InitHotKeys(PWINSTATION_OBJECT WinStaObject);
-NTSTATUS FASTCALL
-CleanupHotKeys(PWINSTATION_OBJECT WinStaObject);
-
-BOOL
-GetHotKey (PWINSTATION_OBJECT WinStaObject,
- UINT fsModifiers,
- UINT vk,
- struct _ETHREAD **Thread,
- HWND *hWnd,
- int *id);
-
-VOID
-UnregisterWindowHotKeys(PWINDOW_OBJECT Window);
-
-VOID
-UnregisterThreadHotKeys(struct _ETHREAD *Thread);
-
-#define IntLockHotKeys(WinStaObject) \
- ExAcquireFastMutex(&WinStaObject->HotKeyListLock)
-
-#define IntUnLockHotKeys(WinStaObject) \
- ExReleaseFastMutex(&WinStaObject->HotKeyListLock)
-
#endif /* _WIN32K_HOTKEY_H */
/* EOF */
_____
Modified: branches/win32k rewrite attempt/win32k/include/menu.h
--- branches/win32k rewrite attempt/win32k/include/menu.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/menu.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -31,6 +31,13 @@
typedef struct _MENU_OBJECT
{
+/*---------- USER_OBJECT_HDR --------------*/
+ HMENU hSelf;
+ LONG refs;
+ BYTE flags;
+
+/*---------- USER_OBJECT_HDR --------------*/
+
PEPROCESS Process;
LIST_ENTRY ListEntry;
PMENU_ITEM MenuItemList;
@@ -39,78 +46,6 @@
} MENU_OBJECT, *PMENU_OBJECT;
-BOOL FASTCALL
-IntFreeMenuItem(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem,
- BOOL RemoveFromList, BOOL bRecurse);
-BOOL FASTCALL
-IntRemoveMenuItem(PMENU_OBJECT MenuObject, UINT uPosition, UINT uFlags,
- BOOL bRecurse);
-UINT FASTCALL
-IntDeleteMenuItems(PMENU_OBJECT MenuObject, BOOL bRecurse);
-
-BOOL FASTCALL
-IntDestroyMenuObject(PMENU_OBJECT MenuObject, BOOL bRecurse, BOOL
RemoveFromProcess);
-
-PMENU_OBJECT FASTCALL
-IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar);
-
-PMENU_OBJECT FASTCALL
-IntCloneMenu(PMENU_OBJECT Source);
-
-BOOL FASTCALL
-UserSetMenuFlagRtoL(PMENU_OBJECT MenuObject);
-
-BOOL FASTCALL
-IntSetMenuContextHelpId(PMENU_OBJECT MenuObject, DWORD
dwContextHelpId);
-
-BOOL FASTCALL
-UserGetMenuInfo(PMENU_OBJECT MenuObject, PROSMENUINFO lpmi);
-
-BOOL FASTCALL
-IntIsMenu(HMENU hMenu);
-
-BOOL FASTCALL
-UserSetMenuInfo(PMENU_OBJECT MenuObject, PROSMENUINFO lpmi);
-
-BOOL FASTCALL
-UserMenuItemInfo(
- PMENU_OBJECT Menu,
- UINT Item,
- BOOL ByPosition,
- PROSMENUITEMINFO ItemInfo,
- BOOL Set
- );
-
-int FASTCALL
-UserGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT
fFlag,
- PMENU_ITEM *MenuItem, PMENU_ITEM *PrevMenuItem);
-
-UINT FASTCALL
-IntEnableMenuItem(PMENU_OBJECT MenuObject, UINT uIDEnableItem, UINT
uEnable);
-
-DWORD FASTCALL
-IntCheckMenuItem(PMENU_OBJECT MenuObject, UINT uIDCheckItem, UINT
uCheck);
-
-BOOL FASTCALL
-IntSetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT uItem, UINT
fByPos);
-
-BOOL FASTCALL
-IntSetMenuItemRect(PMENU_OBJECT MenuObject, UINT Item, BOOL fByPos,
RECT *rcRect);
-
-BOOL FASTCALL
-IntCleanupMenus(struct _EPROCESS *Process, PW32PROCESS Win32Process);
-
-BOOL FASTCALL
-IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL
fByPosition,
- PROSMENUITEMINFO ItemInfo);
-
-
-NTSTATUS FASTCALL
-InitMenuImpl(VOID);
-
-NTSTATUS FASTCALL
-CleanupMenuImpl(VOID);
-
#endif /* _WIN32K_MENU_H */
_____
Modified: branches/win32k rewrite attempt/win32k/include/monitor.h
--- branches/win32k rewrite attempt/win32k/include/monitor.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/monitor.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -6,8 +6,12 @@
/* monitor object */
typedef struct _MONITOR_OBJECT
{
- HANDLE Handle; /* system object handle */
- FAST_MUTEX Lock; /* R/W lock */
+/*---------- USER_OBJECT_HDR --------------*/
+ HMONITOR hSelf;
+ LONG refs;
+ BYTE hdrFlags;
+
+/*---------- USER_OBJECT_HDR --------------*/
BOOL IsPrimary; /* wether this is the primary monitor
*/
UNICODE_STRING DeviceName; /* name of the monitor */
@@ -16,13 +20,7 @@
struct _MONITOR_OBJECT *Prev, *Next; /* doubly linked list */
} MONITOR_OBJECT, *PMONITOR_OBJECT;
-/* functions */
-NTSTATUS InitMonitorImpl();
-NTSTATUS CleanupMonitorImpl();
-NTSTATUS IntAttachMonitor(GDIDEVICE *pGdiDevice, ULONG DisplayNumber);
-NTSTATUS IntDetachMonitor(GDIDEVICE *pGdiDevice);
-
#endif /* _WIN32K_MONITOR_H */
/* EOF */
_____
Modified: branches/win32k rewrite attempt/win32k/include/ntuser.h
--- branches/win32k rewrite attempt/win32k/include/ntuser.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/ntuser.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -1,6 +1,22 @@
#ifndef _WIN32K_NTUSER_H
#define _WIN32K_NTUSER_H
+
+typedef struct _USER_OBJECT_HDR
+{
+ HANDLE hSelf;
+ LONG refs;
+ BYTE flags;
+} USER_OBJECT_HDR, *PUSER_OBJECT_HDR;
+
+
+typedef struct _USER_REFERENCE_ENTRY
+{
+ SINGLE_LIST_ENTRY Entry;
+ PUSER_OBJECT_HDR hdr;
+} USER_REFERENCE_ENTRY, *PUSER_REFERENCE_ENTRY;
+
+
extern char* _file;
extern DWORD _line;
extern DWORD _locked;
@@ -98,59 +114,12 @@
-#define FIRST_USER_HANDLE 0x0020 /* first possible value for low word
of user handle */
-#define LAST_USER_HANDLE 0xffef /* last possible value for low word
of user handle */
-typedef struct _USER_HANDLE_ENTRY
-{
- void *ptr; /* pointer to object */
- unsigned short type; /* object type (0 if free) */
- unsigned short generation; /* generation counter */
-} USER_HANDLE_ENTRY, * PUSER_HANDLE_ENTRY;
-typedef struct _USER_HANDLE_TABLE
-{
- PUSER_HANDLE_ENTRY handles;
- PUSER_HANDLE_ENTRY freelist;
- int nb_handles;
- int allocated_handles;
-} USER_HANDLE_TABLE, * PUSER_HANDLE_TABLE;
-/*
-typedef enum {
- otFree = 0,
- otClass,
- otWnd,
- otMenu,
- otAccel,
- otCursor,
- otHook,
- otMonitor
-} USER_OBJECT_TYPE;
-*/
-
-typedef enum _USER_OBJECT_TYPE
-{
- /* 0 = free */
- USER_CLASS = 1,
- USER_WINDOW,
- USER_MENU,
- USER_ACCELERATOR_TABLE,
- USER_CURSOR_ICON,
- USER_HOOK_PROC,
- USER_MONITOR
-
-} USER_OBJECT_TYPE;
-
-
-
-
-
-
-
#endif /* _WIN32K_NTUSER_H */
/* EOF */
_____
Modified: branches/win32k rewrite attempt/win32k/include/object.h
--- branches/win32k rewrite attempt/win32k/include/object.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/object.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -6,6 +6,8 @@
#include <win32k/pen.h>
+#define USER_OBJ_DESTROYING (0x1)
+#define USER_OBJ_DESTROYED (0x2)
VOID INTERNAL_CALL InitGdiObjectHandleTable (VOID);
VOID FASTCALL CreateStockObjects (VOID);
_____
Modified: branches/win32k rewrite attempt/win32k/include/scroll.h
--- branches/win32k rewrite attempt/win32k/include/scroll.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/scroll.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -7,16 +7,5 @@
SCROLLINFO ScrollInfo;
} WINDOW_SCROLLINFO, *PWINDOW_SCROLLINFO;
-#define IntGetScrollbarInfoFromWindow(Window, i) \
- ((PSCROLLBARINFO)(&((Window)->Scroll + i)->ScrollBarInfo))
-#define IntGetScrollInfoFromWindow(Window, i) \
- ((LPSCROLLINFO)(&((Window)->Scroll + i)->ScrollInfo))
-
-#define SBOBJ_TO_SBID(Obj) ((Obj) - OBJID_HSCROLL)
-#define SBID_IS_VALID(id) (id == SB_HORZ || id == SB_VERT || id ==
SB_CTL)
-
-BOOL FASTCALL IntCreateScrollBars(PWINDOW_OBJECT Window);
-BOOL FASTCALL IntDestroyScrollBars(PWINDOW_OBJECT Window);
-
#endif /* _WIN32K_SCROLL_H */
_____
Deleted: branches/win32k rewrite attempt/win32k/include/useratom.h
--- branches/win32k rewrite attempt/win32k/include/useratom.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/useratom.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -1,9 +0,0 @@
-#ifndef _WIN32K_USERATOM_H
-#define _WIN32K_USERATOM_H
-
-RTL_ATOM FASTCALL
-IntAddAtom(LPWSTR AtomName);
-ULONG FASTCALL
-IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize);
-
-#endif /* _WIN32K_USERATOM_H */
_____
Modified: branches/win32k rewrite attempt/win32k/include/userfuncs.h
--- branches/win32k rewrite attempt/win32k/include/userfuncs.h
2005-08-29 13:54:05 UTC (rev 17589)
+++ branches/win32k rewrite attempt/win32k/include/userfuncs.h
2005-08-29 14:24:38 UTC (rev 17590)
@@ -1,9 +1,28 @@
#ifndef _WIN32K_USERFUNCS_H
#define _WIN32K_USERFUNCS_H
+extern PWINSTATION_OBJECT gInteractiveWinSta;
#define QUEUE_2_WTHREAD(queue) CONTAINING_RECORD(queue, W32THREAD,
Queue)
+
+
+#define UserGetInputDesktop() (gInputDesktop)
+
+#define UserGetCurrentQueue() (&PsGetWin32Thread()->Queue)
+
+#define UserGetForegroundWThread()
(QUEUE_2_WTHREAD(gInputDesktop->ActiveQueue))
+#define UserGetForegroundQueue() (gInputDesktop->ActiveQueue)
+#define UserSetForegroundQueue(q) (gInputDesktop->ActiveQueue = (q))
+
+
+/*************** USERATOM.C ******************/
+
+RTL_ATOM FASTCALL
+IntAddAtom(LPWSTR AtomName);
+ULONG FASTCALL
+IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize);
+
/*************** KEYBOARD.C ******************/
DWORD FASTCALL
@@ -12,9 +31,47 @@
BOOL FASTCALL
IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl);
+/******************** OBJECT.C ***************/
+BOOLEAN FASTCALL UserSetCheckDestroy(PUSER_OBJECT_HDR hdr);
+
+VOID FASTCALL UserDestroyObject(PUSER_OBJECT_HDR obj);
+
/******************** HANDLE.C ***************/
+extern USER_HANDLE_TABLE gHandleTable;
+
+PUSER_HANDLE_ENTRY handle_to_entry(PUSER_HANDLE_TABLE ht, HANDLE handle
);
+
+
+#include <malloc.h>
+
+
+#define UserReferenceObject(obj) (obj->hdr.refs++)
+
+#define UserDereferenceObject(obj){ \
+ if (--obj->hdr.refs == 0 && obj->hdr.flags & USER_OBJ_DESTROYING
&&
!(obj->hdr.flags & USER_OBJ_DESTROYED)){ \
+ UserDestroyObject(&obj->hdr); \
+ } \
+}
+
+
+#define UserReferenceObjectCo(obj){ \
+ PUSER_REFERENCE_ENTRY ref =
(PUSER_REFERENCE_ENTRY)_alloca(sizeof(USER_REFERENCE_ENTRY)); \
+ obj->hdr.refs++; \
+ ref->hdr = &obj->hdr; \
+ PushEntryList(&PsGetWin32Thread()->UserObjReferencesStack,
&ref->Entry); \
+}
+
+#define UserDereferenceObjectCo(obj){ \
+ PSINGLE_LIST_ENTRY entry =
PopEntryList(&PsGetWin32Thread()->UserObjReferencesStack); \
+ PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(entry,
USER_REFERENCE_ENTRY, Entry); \
+ ASSERT(&obj->hdr == ref->hdr); \
+ if (--ref->hdr->refs == 0 && obj->hdr.flags & USER_OBJ_DESTROYING
&&
!(obj->hdr.flags & USER_OBJ_DESTROYED)) { \
+ UserDestroyObject(ref->hdr); \
+ } \
+}
+
VOID UserInitHandleTable(PUSER_HANDLE_TABLE ht, PVOID mem, ULONG
bytes);
HANDLE UserAllocHandle(PUSER_HANDLE_TABLE ht, PVOID object,
USER_OBJECT_TYPE type );
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle,
USER_OBJECT_TYPE type );
@@ -24,14 +81,59 @@
/************* PROP.C *****************/
BOOL FASTCALL
-IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data);
+UserSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data);
PPROPERTY FASTCALL
-IntGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom);
+UserGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom);
+/************* CALLBACK.C *****************/
+
+LRESULT STDCALL
+coUserCallWindowProc(WNDPROC Proc,
+ BOOLEAN IsAnsiProc,
+ HWND Wnd,
+ UINT Message,
+ WPARAM wParam,
+ LPARAM lParam,
+ INT lParamBufferSize);
+
+VOID STDCALL
+coUserCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
+ HWND hWnd,
+ UINT Msg,
+ ULONG_PTR CompletionCallbackContext,
+ LRESULT Result);
+
+
+HMENU STDCALL
+coUserLoadSysMenuTemplate();
+
+BOOL STDCALL
+coUserLoadDefaultCursors(VOID);
+
+LRESULT STDCALL
+coUserCallHookProc(INT HookId,
+ INT Code,
+ WPARAM wParam,
+ LPARAM lParam,
+ HOOKPROC Proc,
+ BOOLEAN Ansi,
+ PUNICODE_STRING ModuleName);
+
+VOID FASTCALL
+IntCleanupThreadCallbacks(PW32THREAD W32Thread);
+
+PVOID FASTCALL
+IntCbAllocateMemory(ULONG Size);
+
+VOID FASTCALL
+IntCbFreeMemory(PVOID Data);
+
/************* DESKTOP.C *****************/
+extern PDESKTOP_OBJECT gInputDesktop;
+
inline PDESKTOP_OBJECT FASTCALL UserGetCurrentDesktop();
NTSTATUS FASTCALL
@@ -74,7 +176,7 @@
UserGetActiveDesktop(VOID);
NTSTATUS FASTCALL
-UserShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
+coUserShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
NTSTATUS FASTCALL
IntHideDesktop(PDESKTOP_OBJECT Desktop);
@@ -103,20 +205,30 @@
VOID IntShellHookNotify(WPARAM Message, LPARAM lParam);
-#define IntIsActiveDesktop(Desktop) \
- ((Desktop)->WindowStation->ActiveDesktop == (Desktop))
+#define IntIsActiveDesktop(Desktop) ((Desktop) == (gInputDesktop))
/************************* ACCELERATOR.C ***********************/
+BOOLEAN FASTCALL UserDestroyAccel(PACCELERATOR_TABLE Accel);
+
inline PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hCursor);
-PACCELERATOR_TABLE FASTCALL UserCreateAccelObject(HACCEL* h);
+PACCELERATOR_TABLE FASTCALL UserCreateAccelObject();
+NTSTATUS FASTCALL
+InitAcceleratorImpl();
+NTSTATUS FASTCALL
+CleanupAcceleratorImpl();
-/* metric.c */
+VOID
+RegisterThreadAcceleratorTable(struct _ETHREAD *Thread);
+
+/************************* METRIC.C ***********************/
+
+
ULONG FASTCALL
UserGetSystemMetrics(ULONG Index);
@@ -150,9 +262,8 @@
/******************** FOCUS.C ********************************/
-inline PUSER_MESSAGE_QUEUE FASTCALL UserGetForegroundQueue();
-inline VOID FASTCALL UserSetForegroundQueue(PUSER_MESSAGE_QUEUE Queue);
+//inline VOID FASTCALL UserSetForegroundQueue(PUSER_MESSAGE_QUEUE
Queue);
/*
@@ -170,17 +281,17 @@
UserGetThreadFocusWindow();
BOOL FASTCALL
-IntMouseActivateWindow(PWINDOW_OBJECT Window);
+coUserMouseActivateWindow(PWINDOW_OBJECT Window);
BOOL FASTCALL
-IntSetForegroundWindow(PWINDOW_OBJECT Window);
+coUserSetForegroundWindow(PWINDOW_OBJECT Window);
PWINDOW_OBJECT FASTCALL
-IntSetActiveWindow(PWINDOW_OBJECT Window);
+coUserSetActiveWindow(PWINDOW_OBJECT Window);
PWINDOW_OBJECT FASTCALL
UserGetForegroundWindow(VOID);
PWINDOW_OBJECT FASTCALL
-UserSetFocus(PWINDOW_OBJECT Wnd OPTIONAL);
+coUserSetFocus(PWINDOW_OBJECT Wnd OPTIONAL);
/******************** PAINTING.C ********************************/
@@ -188,12 +299,12 @@
VOID FASTCALL
IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion);
BOOL FASTCALL
-UserRedrawWindow(PWINDOW_OBJECT Wnd, const RECT* UpdateRect, HRGN
UpdateRgn, ULONG Flags);
+coUserRedrawWindow(PWINDOW_OBJECT Wnd, const RECT* UpdateRect, HRGN
UpdateRgn, ULONG Flags);
BOOL FASTCALL
IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
PW32THREAD Thread,
MSG *Message, BOOL Remove);
-BOOL FASTCALL UserValidateRgn(PWINDOW_OBJECT hWnd, HRGN hRgn);
+BOOL FASTCALL coUserValidateRgn(PWINDOW_OBJECT hWnd, HRGN hRgn);
#define IntLockWindowUpdate(Window) \
@@ -210,7 +321,7 @@
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate);
INT FASTCALL
-UserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase);
+coUserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase);
/******************** MESSAGE.C ********************************/
@@ -218,19 +329,15 @@
UserPostMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT FASTCALL
-IntSendMessage(HWND hWnd,
+coUserSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
-LRESULT FASTCALL
-IntPostOrSendMessage(HWND hWnd,
- UINT Msg,
- WPARAM wParam,
- LPARAM lParam);
+
LRESULT FASTCALL
-IntSendMessageTimeout(HWND hWnd,
+coUserSendMessageTimeout(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
@@ -245,11 +352,14 @@
/************************ WINDOW.C *****************************/
+BOOL FASTCALL
+UserSetSystemMenu(PWINDOW_OBJECT WindowObject, PMENU_OBJECT
MenuObject);
+
inline VOID FASTCALL UserFreeWindowObject(PWINDOW_OBJECT Wnd);
PWINDOW_OBJECT FASTCALL IntGetWindowObject(HWND hWnd);
-PWINDOW_OBJECT FASTCALL UserCreateWindowObject(HWND* h, ULONG bytes);
+PWINDOW_OBJECT FASTCALL UserCreateWindowObject(ULONG bytes);
PWINDOW_OBJECT FASTCALL
UserGetWindow(PWINDOW_OBJECT Wnd, UINT Relationship);
@@ -258,10 +368,10 @@
UserGetWindowLong(PWINDOW_OBJECT Wnd, DWORD Index, BOOL Ansi);
LONG FASTCALL
-UserSetWindowLong(PWINDOW_OBJECT Wnd, DWORD Index, LONG NewValue, BOOL
Ansi);
+coUserSetWindowLong(PWINDOW_OBJECT Wnd, DWORD Index, LONG NewValue,
BOOL Ansi);
BOOLEAN FASTCALL
-UserDestroyWindow(PWINDOW_OBJECT Wnd);
+coUserDestroyWindow(PWINDOW_OBJECT Wnd);
HWND FASTCALL
GetHwnd(PWINDOW_OBJECT Wnd);
@@ -270,33 +380,171 @@
[truncated at 1000 lines; 8280 more skipped]