diff --git a/reactos/include/win32k/ntuser.h b/reactos/include/win32k/ntuser.h index 89394ed3124..a1f1687dfb9 100644 --- a/reactos/include/win32k/ntuser.h +++ b/reactos/include/win32k/ntuser.h @@ -163,6 +163,7 @@ NtUserCallNoParam( #define ONEPARAM_ROUTINE_GETMENU 0x01 #define ONEPARAM_ROUTINE_ISWINDOWUNICODE 0x02 +#define ONEPARAM_ROUTINE_WINDOWFROMDC 0x03 DWORD STDCALL NtUserCallOneParam( diff --git a/reactos/lib/user32/windows/dc.c b/reactos/lib/user32/windows/dc.c index 4c4048c2b9a..72c333617e6 100644 --- a/reactos/lib/user32/windows/dc.c +++ b/reactos/lib/user32/windows/dc.c @@ -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: dc.c,v 1.12 2003/07/10 21:04:31 chorns Exp $ +/* $Id: dc.c,v 1.13 2003/08/17 09:17:04 weiden Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/input.c @@ -87,13 +87,12 @@ ReleaseDC( /* - * @unimplemented + * @implemented */ HWND STDCALL WindowFromDC( HDC hDC) { - UNIMPLEMENTED; - return (HWND)0; + return (HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC); } diff --git a/reactos/subsys/win32k/include/dce.h b/reactos/subsys/win32k/include/dce.h index 931b2ef7daf..4d946bf4fb3 100644 --- a/reactos/subsys/win32k/include/dce.h +++ b/reactos/subsys/win32k/include/dce.h @@ -47,5 +47,6 @@ HRGN STDCALL DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags) INT FASTCALL DCE_ExcludeRgn(HDC, HWND, HRGN); BOOL FASTCALL DCE_InvalidateDCE(HWND, const PRECTL); BOOL FASTCALL DCE_InternalDelete(PDCE dce); +HWND FASTCALL W32kWindowFromDC(HDC hDc); #endif diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index 549a4f54f6b..d49766d4895 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.4 2003/08/11 21:10:49 royce Exp $ +/* $Id: misc.c,v 1.5 2003/08/17 09:17:04 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -13,6 +13,7 @@ #include #include #include +#include #define NDEBUG #include @@ -68,6 +69,9 @@ NtUserCallOneParam( Result = WindowObject->Unicode; W32kReleaseWindowObject(WindowObject); return Result; + + case ONEPARAM_ROUTINE_WINDOWFROMDC: + return (DWORD)W32kWindowFromDC((HDC)Param); } DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam()\n Param=0x%x\n", diff --git a/reactos/subsys/win32k/ntuser/windc.c b/reactos/subsys/win32k/ntuser/windc.c index 89c17e1b448..8edd36dd444 100644 --- a/reactos/subsys/win32k/ntuser/windc.c +++ b/reactos/subsys/win32k/ntuser/windc.c @@ -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: windc.c,v 1.19 2003/08/11 19:05:26 gdalsnes Exp $ +/* $Id: windc.c,v 1.20 2003/08/17 09:17:04 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -467,6 +467,20 @@ DCE_InternalDelete(PDCE Dce) return NULL != PrevInList; } + +HWND FASTCALL +W32kWindowFromDC(HDC hDc) +{ + DCE *Dce; + for (Dce = FirstDce; Dce != NULL; Dce = Dce->next) + { + if(Dce->hDC == hDc) + { + return Dce->hwndCurrent; + } + } + return 0; +} /* EOF */