Author: jimtabor
Date: Sun Jul 19 23:18:08 2009
New Revision: 42092
URL:
http://svn.reactos.org/svn/reactos?rev=42092&view=rev
Log:
- [Win32k] Make co_IntCreateWindowEx return pointer to public window structure.
Modified:
trunk/reactos/subsystems/win32/win32k/include/desktop.h
trunk/reactos/subsystems/win32/win32k/include/window.h
trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Sun Jul 19
23:18:08 2009
@@ -28,7 +28,7 @@
PWIN32HEAP pheapDesktop;
PSECTION_OBJECT DesktopHeapSection;
PDESKTOPINFO DesktopInfo;
- HWND spwndMessage;
+ PWINDOW spwndMessage;
} DESKTOP, *PDESKTOP;
extern PDESKTOP InputDesktop;
Modified: trunk/reactos/subsystems/win32/win32k/include/window.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Sun Jul 19
23:18:08 2009
@@ -171,7 +171,7 @@
VOID FASTCALL IntNotifyWinEvent(DWORD, HWND, LONG, LONG);
-HWND APIENTRY
co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PUNICODE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL);
+PWINDOW APIENTRY
co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PUNICODE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL);
#endif /* _WIN32K_WINDOW_H */
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Sun Jul 19
23:18:08 2009
@@ -566,7 +566,7 @@
DPRINT("No active desktop\n");
return NULL;
}
- return pdo->spwndMessage;
+ return pdo->spwndMessage->hdr.Handle;
}
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
@@ -898,7 +898,6 @@
{
OBJECT_ATTRIBUTES ObjectAttributes;
PTHREADINFO W32Thread;
- HWND hwndMessage;
PWINSTATION_OBJECT WinStaObject;
PDESKTOP DesktopObject;
UNICODE_STRING DesktopName;
@@ -916,6 +915,7 @@
PPROCESSINFO pi = GetW32ProcessInfo();
WNDCLASSEXW wc;
PWINDOWCLASS Class;
+ PWINDOW pWnd;
DECLARE_RETURN(HDESK);
DPRINT("Enter NtUserCreateDesktop: %wZ\n", lpszDesktopName);
@@ -1149,27 +1149,27 @@
DPRINT1("!!! Registering Message system class failed!\n");
}
- hwndMessage = co_IntCreateWindowEx( 0,
- &ClassName,
- &WindowName,
- (WS_POPUP|WS_CLIPCHILDREN),
- 0,
- 0,
- 100,
- 100,
- NULL,
- NULL,
- pi->hModUser, // hModClient;
- NULL,
- 0,
- TRUE);
- if (!hwndMessage)
+ pWnd = co_IntCreateWindowEx( 0,
+ &ClassName,
+ &WindowName,
+ (WS_POPUP|WS_CLIPCHILDREN),
+ 0,
+ 0,
+ 100,
+ 100,
+ NULL,
+ NULL,
+ pi->hModUser, // hModClient;
+ NULL,
+ 0,
+ TRUE);
+ if (!pWnd)
{
DPRINT1("Failed to create Message window handle\n");
}
else
{
- DesktopObject->spwndMessage = hwndMessage;
+ DesktopObject->spwndMessage = pWnd;
}
RETURN( Desktop);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Sun Jul 19 23:18:08
2009
@@ -1518,7 +1518,7 @@
/*
* @implemented
*/
-HWND APIENTRY
+PWINDOW APIENTRY
co_IntCreateWindowEx(DWORD dwExStyle,
PUNICODE_STRING ClassName,
PUNICODE_STRING WindowName,
@@ -1558,7 +1558,7 @@
CBT_CREATEWNDW CbtCreate;
LRESULT Result;
BOOL MenuChanged;
- DECLARE_RETURN(HWND);
+ DECLARE_RETURN(PWINDOW);
BOOL HasOwner;
USER_REFERENCE_ENTRY ParentRef, Ref;
PTHREADINFO pti;
@@ -1595,7 +1595,7 @@
else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)
{
SetLastWin32Error(ERROR_TLW_WITH_WSCHILD);
- RETURN( (HWND)0); /* WS_CHILD needs a parent, but WS_POPUP doesn't */
+ RETURN( (PWINDOW)0); /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
if (ParentWindowHandle)
@@ -1616,7 +1616,7 @@
if (ti == NULL || pti->Desktop == NULL)
{
DPRINT1("Thread is not attached to a desktop! Cannot create window!\n");
- RETURN( (HWND)0);
+ RETURN( (PWINDOW)0);
}
/* Check the class. */
@@ -1639,7 +1639,7 @@
}
SetLastWin32Error(ERROR_CANNOT_FIND_WND_CLASS);
- RETURN((HWND)0);
+ RETURN((PWINDOW)0);
}
Class = IntReferenceClass(Class,
@@ -1657,9 +1657,10 @@
ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0);
/* Create the window object. */
- Window = (PWINDOW_OBJECT)
- UserCreateObject(gHandleTable, (PHANDLE)&hWnd,
- otWindow, sizeof(WINDOW_OBJECT));
+ Window = (PWINDOW_OBJECT) UserCreateObject( gHandleTable,
+ (PHANDLE)&hWnd,
+ otWindow,
+ sizeof(WINDOW_OBJECT));
if (Window)
{
Window->Wnd = DesktopHeapAlloc(pti->Desktop,
@@ -1668,7 +1669,7 @@
goto AllocErr;
RtlZeroMemory(Window->Wnd,
sizeof(WINDOW) + Class->WndExtra);
- Window->Wnd->hdr.Handle = hWnd; /* FIXME: Remove hack */
+ Window->Wnd->hdr.Handle = hWnd; /* FIXME: Remove hack , are you sure?*/
Wnd = Window->Wnd;
Wnd->ti = ti;
@@ -1683,7 +1684,7 @@
AllocErr:
ObDereferenceObject(WinSta);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
- RETURN( (HWND)0);
+ RETURN( (PWINDOW)0);
}
UserRefObjectCo(Window, &Ref);
@@ -1775,7 +1776,7 @@
if (Wnd->WindowName.Buffer == NULL)
{
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
- RETURN( (HWND)0);
+ RETURN( (PWINDOW)0);
}
Wnd->WindowName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0';
@@ -1885,7 +1886,7 @@
/* FIXME - Delete window object and remove it from the thread windows list */
/* FIXME - delete allocated DCE */
DPRINT1("CBT-hook returned !0\n");
- RETURN( (HWND) NULL);
+ RETURN( (PWINDOW) NULL);
}
}
x = Cs.x;
@@ -2052,7 +2053,7 @@
{
/* FIXME: Cleanup. */
DPRINT1("IntCreateWindowEx(): NCCREATE message failed. No cleanup
performed!\n");
- RETURN((HWND)0);
+ RETURN((PWINDOW)0);
}
/* Calculate the non-client size. */
@@ -2116,7 +2117,7 @@
/* FIXME: Cleanup. */
DPRINT1("IntCreateWindowEx(): send CREATE message failed. No cleanup
performed!\n");
IntUnlinkWindow(Window);
- RETURN((HWND)0);
+ RETURN((PWINDOW)0);
}
IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window->hSelf, OBJID_WINDOW, 0);
@@ -2254,7 +2255,7 @@
DPRINT("IntCreateWindow(): = %X\n", hWnd);
DPRINT("WindowObject->SystemMenu = 0x%x\n", Window->SystemMenu);
- RETURN(hWnd);
+ RETURN( Wnd);
CLEANUP:
if (!_ret_ && Window && Window->Wnd && ti)
@@ -2297,7 +2298,8 @@
NTSTATUS Status;
UNICODE_STRING WindowName;
UNICODE_STRING ClassName;
- HWND NewWindow;
+ HWND NewWindow = NULL;
+ PWINDOW pNewWindow;
DECLARE_RETURN(HWND);
DPRINT("Enter NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth,
nHeight);
@@ -2344,8 +2346,22 @@
RtlInitUnicodeString(&WindowName, NULL);
}
- NewWindow = co_IntCreateWindowEx(dwExStyle, &ClassName, &WindowName, dwStyle,
x, y, nWidth, nHeight,
- hWndParent, hMenu, hInstance, lpParam, dwShowMode,
bUnicodeWindow);
+ pNewWindow = co_IntCreateWindowEx( dwExStyle,
+ &ClassName,
+ &WindowName,
+ dwStyle,
+ x,
+ y,
+ nWidth,
+ nHeight,
+ hWndParent,
+ hMenu,
+ hInstance,
+ lpParam,
+ dwShowMode,
+ bUnicodeWindow);
+
+ if (pNewWindow) NewWindow = pNewWindow->hdr.Handle;
if (WindowName.Buffer)
{