mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
store ShellWindow and ShellListView handle in window station and minor fix on destroying icons
svn path=/trunk/; revision=6953
This commit is contained in:
parent
c4403877c7
commit
a9272c95c1
4 changed files with 80 additions and 25 deletions
|
@ -1460,7 +1460,7 @@ NtUserSetScrollInfo(
|
|||
LPSCROLLINFO lpsi,
|
||||
DWORD *Changed);
|
||||
|
||||
DWORD
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserSetShellWindowEx(
|
||||
HWND hwndShell,
|
||||
|
|
|
@ -51,6 +51,8 @@ typedef struct _WINSTATION_OBJECT
|
|||
HANDLE SystemMenuTemplate;
|
||||
SYSTEM_CURSORINFO SystemCursor;
|
||||
UINT CaretBlinkRate;
|
||||
HANDLE ShellWindow;
|
||||
HANDLE ShellListView;
|
||||
struct _DESKTOP_OBJECT* ActiveDesktop;
|
||||
/* FIXME: Clipboard */
|
||||
LIST_ENTRY HotKeyListHead;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: window.c,v 1.155 2003/12/08 18:21:25 navaraf Exp $
|
||||
/* $Id: window.c,v 1.156 2003/12/10 22:09:56 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -71,10 +71,6 @@ static WORD WndProcHandlesArraySize = 0;
|
|||
#define REGISTERED_MESSAGE_MAX 0xffff
|
||||
#define WPH_SIZE 0x40 /* the size to add to the WndProcHandle array each time */
|
||||
|
||||
/* globally stored handles to the shell windows */
|
||||
HWND hwndShellWindow = 0;
|
||||
HWND hwndShellListView = 0;
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
/*
|
||||
|
@ -315,11 +311,14 @@ static LRESULT IntDestroyWindow(PWINDOW_OBJECT Window,
|
|||
}
|
||||
|
||||
/* reset shell window handles */
|
||||
if (Window->Self == hwndShellWindow)
|
||||
hwndShellWindow = 0;
|
||||
if(ProcessData->WindowStation)
|
||||
{
|
||||
if (Window->Self == ProcessData->WindowStation->ShellWindow)
|
||||
ProcessData->WindowStation->ShellWindow = NULL;
|
||||
|
||||
if (Window->Self == hwndShellListView)
|
||||
hwndShellListView = 0;
|
||||
if (Window->Self == ProcessData->WindowStation->ShellListView)
|
||||
ProcessData->WindowStation->ShellListView = NULL;
|
||||
}
|
||||
|
||||
/* Unregister hot keys */
|
||||
UnregisterWindowHotKeys (Window);
|
||||
|
@ -2065,7 +2064,24 @@ NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
|
|||
HWND STDCALL
|
||||
NtUserGetShellWindow()
|
||||
{
|
||||
return hwndShellWindow;
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
HWND Ret;
|
||||
|
||||
NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return (HWND)0;
|
||||
}
|
||||
|
||||
Ret = (HWND)WinStaObject->ShellWindow;
|
||||
|
||||
ObDereferenceObject(WinStaObject);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2078,14 +2094,30 @@ NtUserGetShellWindow()
|
|||
* @implemented
|
||||
*/
|
||||
|
||||
DWORD STDCALL
|
||||
BOOL STDCALL
|
||||
NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
|
||||
{
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
|
||||
NTSTATUS Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if we are permitted to change the shell window.
|
||||
*/
|
||||
if (hwndShellWindow)
|
||||
if (WinStaObject->ShellWindow)
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Move shell window into background.
|
||||
|
@ -2101,17 +2133,24 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
|
|||
#endif
|
||||
|
||||
if (NtUserGetWindowLong(hwndListView, GWL_EXSTYLE, FALSE) & WS_EX_TOPMOST)
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (NtUserGetWindowLong(hwndShell, GWL_EXSTYLE, FALSE) & WS_EX_TOPMOST)
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WinPosSetWindowPos(hwndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
|
||||
|
||||
hwndShellWindow = hwndShell;
|
||||
hwndShellListView = hwndListView;
|
||||
|
||||
WinStaObject->ShellWindow = hwndShell;
|
||||
WinStaObject->ShellListView = hwndListView;
|
||||
|
||||
ObDereferenceObject(WinStaObject);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2414,6 +2453,8 @@ LONG STDCALL
|
|||
NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
||||
{
|
||||
PWINDOW_OBJECT WindowObject;
|
||||
PW32PROCESS Process;
|
||||
PWINSTATION_OBJECT WindowStation;
|
||||
LONG OldValue;
|
||||
STYLESTRUCT Style;
|
||||
|
||||
|
@ -2453,8 +2494,13 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
|||
/*
|
||||
* Remove extended window style bit WS_EX_TOPMOST for shell windows.
|
||||
*/
|
||||
if (hWnd == hwndShellWindow || hWnd == hwndShellListView)
|
||||
Style.styleNew &= ~WS_EX_TOPMOST;
|
||||
Process = WindowObject->OwnerThread->ThreadsProcess->Win32Process;
|
||||
WindowStation = Process->WindowStation;
|
||||
if(WindowStation)
|
||||
{
|
||||
if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
|
||||
Style.styleNew &= ~WS_EX_TOPMOST;
|
||||
}
|
||||
|
||||
IntSendSTYLECHANGINGMessage(hWnd, GWL_EXSTYLE, &Style);
|
||||
WindowObject->ExStyle = (DWORD)Style.styleNew;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: cursoricon.c,v 1.33 2003/12/10 17:33:42 gvg Exp $ */
|
||||
/* $Id: cursoricon.c,v 1.34 2003/12/10 22:09:56 weiden Exp $ */
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
@ -294,7 +294,9 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle)
|
|||
{
|
||||
PUSER_HANDLE_TABLE HandleTable;
|
||||
PCURICON_OBJECT Object;
|
||||
HBITMAP bmpMask, bmpColor;
|
||||
NTSTATUS Status;
|
||||
BOOL Ret;
|
||||
|
||||
HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
|
||||
|
||||
|
@ -304,15 +306,20 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Delete the bitmaps */
|
||||
if(Object->IconInfo.hbmMask)
|
||||
NtGdiDeleteObject(Object->IconInfo.hbmMask);
|
||||
if(Object->IconInfo.hbmColor)
|
||||
NtGdiDeleteObject(Object->IconInfo.hbmColor);
|
||||
bmpMask = Object->IconInfo.hbmMask;
|
||||
bmpColor = Object->IconInfo.hbmColor;
|
||||
|
||||
ObmDereferenceObject(Object);
|
||||
|
||||
return NT_SUCCESS(ObmCloseHandle(HandleTable, Handle));
|
||||
Ret = NT_SUCCESS(ObmCloseHandle(HandleTable, Handle));
|
||||
|
||||
/* delete bitmaps */
|
||||
if(bmpMask)
|
||||
NtGdiDeleteObject(bmpMask);
|
||||
if(bmpColor)
|
||||
NtGdiDeleteObject(bmpColor);
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue