2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>

* tools/helper.mk: Make an import library a proper target
	depending on the .def file.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began
	implementation.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* subsys/win32k/misc/object.c (ObmCreateHandle): Return the
	correct handle value.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* subsys/win32k/makefile: Make win32k depend on the file containing
	the service table.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet,
	KePushAndStackSwitchAndSysRet): Push one value only.
	* ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved
	these functions to a new file. Restore the old trap frame after
	returning from a callback.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW):
	Convert message to Unicode or ASCII if necessary.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE
	callbacks.
	* lib/user32/windows/window.c (User32SendCREATEMessageForKernel,
	User32SendNCCREATEMessageForKernel): Implemented.
	* subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage):
	Implemented.

2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* include/structs.h: Added Unicode and ASCII versions of
	CREATESTRUCT.

svn path=/trunk/; revision=3118
This commit is contained in:
David Welch 2002-06-18 21:51:11 +00:00
parent 3acd677b53
commit 5f997bca7b
20 changed files with 387 additions and 262 deletions

View file

@ -1,6 +1,53 @@
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* tools/helper.mk: Make an import library a proper target
depending on the .def file.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began
implementation.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* subsys/win32k/misc/object.c (ObmCreateHandle): Return the
correct handle value.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* subsys/win32k/makefile: Make win32k depend on the file containing
the service table.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet,
KePushAndStackSwitchAndSysRet): Push one value only.
* ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved
these functions to a new file. Restore the old trap frame after
returning from a callback.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW):
Convert message to Unicode or ASCII if necessary.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE
callbacks.
* lib/user32/windows/window.c (User32SendCREATEMessageForKernel,
User32SendNCCREATEMessageForKernel): Implemented.
* subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage):
Implemented.
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* include/structs.h: Added Unicode and ASCII versions of
CREATESTRUCT.
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* tools/help.mk: Make the install target depend on all the
* tools/helper.mk: Make the install target depend on all the
files to be installed.
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
@ -9,7 +56,7 @@
top of the old stack.
* ntoskrnl/ps/thread.c (NtW32Call): Set TSS.Esp0 to the top of
the new stack. Free the callback stack correctly. Don't copy
portion of the trap frame that doesn't exist in none v86-mode
portion of the trap frame that doesn't exist in non-v86-mode
interrupts.
* ntoskrnl/ps/thread.c (PsFreeCallbackStack): New function to
free a stack allocated with PsAllocateCallbackStack.

View file

@ -401,6 +401,7 @@ NtUserGetUpdateRect 3
NtUserGetUpdateRgn 3
NtUserGetWindowDC 1
NtUserGetWindowPlacement 2
NtUserGetWindowLong 2
NtUserGetWOWClass 2
NtUserHideCaret 1
NtUserHiliteMenuItem 4

View file

@ -364,6 +364,36 @@ typedef struct tagCREATESTRUCT {
DWORD dwExStyle;
} CREATESTRUCT, *LPCREATESTRUCT;
typedef struct tagCREATESTRUCTA {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCSTR lpszName;
LPCSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCTA, *LPCREATESTRUCTA;
typedef struct tagCREATESTRUCTW {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCWSTR lpszName;
LPCWSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCTW, *LPCREATESTRUCTW;
typedef struct tagCBT_CREATEWND {
LPCREATESTRUCT lpcs;
HWND hwndInsertAfter;

View file

@ -4,8 +4,9 @@
#define USER32_CALLBACK_WINDOWPROC (0)
#define USER32_CALLBACK_SENDASYNCPROC (1)
#define USER32_CALLBACK_SENDNCCREATE (2)
#define USER32_C
#define USER32_CALLBACK_MAXIMUM (3)
#define USER32_CALLBACK_SENDNCCALCSIZE (3)
#define USER32_CALLBACK_SENDCREATE (4)
#define USER32_CALLBACK_MAXIMUM (4)
typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
{
@ -25,18 +26,26 @@ typedef struct _SENDASYNCPROC_CALLBACK_ARGUMENTS
LRESULT Result;
} SENDASYNCPROC_CALLBACK_ARGUMENTS, *PSENDASYNCPROC_CALLBACK_ARGUMENTS;
typedef struct _SENDNCREATEMESSAGE_CALLBACK_ARGUMENTS
typedef struct _SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS
{
HWND Wnd;
CREATESTRUCT CreateStruct;
} SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS,
*PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS;
typedef struct _SENDCREATEMESSAGE_CALLBACK_ARGUMENTS
{
HWND Wnd;
CREATESTRUCT CreateStruct;
} SENDCREATEMESSAGE_CALLBACK_ARGUMENTS, *PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS;
NTSTATUS STDCALL
User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
NTSTATUS STDCALL
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
#endif /* __INCLUDE_USER32_CALLBACK_H */

View file

@ -1,6 +1,9 @@
#ifndef __WIN32K_NTUSER_H
#define __WIN32K_NTUSER_H
DWORD STDCALL
NtUserGetWindowLong(HWND hWnd, DWORD Index);
NTSTATUS
STDCALL
NtUserAcquireOrReleaseInputOwnership(

View file

@ -1,4 +1,4 @@
/* $Id: callback.c,v 1.4 2002/01/15 00:43:17 dwelch Exp $
/* $Id: callback.c,v 1.5 2002/06/18 21:51:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -32,6 +32,9 @@ KiUserCallbackDispatcher(ULONG RoutineIndex,
Peb = NtCurrentPeb();
Callback = (CALLBACK_FUNCTION)Peb->KernelCallbackTable[RoutineIndex];
DbgPrint("KiUserCallbackDispatcher(%d, %x, %d)\n", RoutineIndex,
Argument, ArgumentLength);
Status = Callback(Argument, ArgumentLength);
DbgPrint("KiUserCallbackDispatcher() finished.\n");
ZwCallbackReturn(NULL, 0, Status);
}

View file

@ -57,6 +57,8 @@ Init(VOID)
(PVOID)User32CallSendAsyncProcForKernel;
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCREATE] =
(PVOID)User32SendNCCREATEMessageForKernel;
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDCREATE] =
(PVOID)User32SendCREATEMessageForKernel;
//ProcessWindowStation = CreateWindowStationW(L"WinStaName",0,GENERIC_ALL,NULL);
//Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL);

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.12 2002/06/14 19:07:32 jfilby Exp $
/* $Id: class.c,v 1.13 2002/06/18 21:51:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -103,22 +103,16 @@ GetClassWord(
return 0;
}
LONG
STDCALL
GetWindowLongA(
HWND hWnd,
int nIndex)
LONG STDCALL
GetWindowLongA(HWND hWnd, int nIndex)
{
return 0;
}
LONG
STDCALL
GetWindowLongW(
HWND hWnd,
int nIndex)
LONG STDCALL
GetWindowLongW(HWND hWnd, int nIndex)
{
return 0;
return(NtUserGetWindowLong(hWnd, nIndex));
}
UINT

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.2 2002/06/13 20:36:40 dwelch Exp $
/* $Id: defwnd.c,v 1.3 2002/06/18 21:51:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -773,7 +773,13 @@ DefWindowProcA(HWND hWnd,
{
case WM_NCCREATE:
{
CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
if (HIWORD(Cs->lpszName))
{
/* FIXME: Set the window title. */
}
Result = 1;
break;
}
case WM_NCCALCSIZE:
@ -820,7 +826,13 @@ DefWindowProcW(HWND hWnd,
{
case WM_NCCREATE:
{
CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
if (HIWORD(Cs->lpszName))
{
/* FIXME: Set the window title. */
}
Result = 1;
break;
}
case WM_NCCALCSIZE:

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.6 2002/06/13 20:36:40 dwelch Exp $
/* $Id: message.c,v 1.7 2002/06/18 21:51:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -60,28 +60,105 @@ SetMessageExtraInfo(
{
return (LPARAM)0;
}
LRESULT
STDCALL
CallWindowProcA(
WNDPROC lpPrevWndFunc,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
VOID STATIC
User32FreeAsciiConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
{
return (LRESULT)0;
switch(Msg)
{
case WM_NCCREATE:
{
CREATESTRUCTA* Cs;
Cs = (CREATESTRUCTA*)lParam;
RtlFreeHeap(RtlGetProcessHeap(), 0, (LPSTR)Cs->lpszName);
RtlFreeHeap(RtlGetProcessHeap(), 0, (LPSTR)Cs->lpszClass);
break;
}
}
}
LRESULT
STDCALL
CallWindowProcW(
WNDPROC lpPrevWndFunc,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
VOID STATIC
User32ConvertToAsciiMessage(UINT* Msg, WPARAM* wParam, LPARAM* lParam)
{
return (LRESULT)0;
switch((*Msg))
{
case WM_NCCREATE:
{
CREATESTRUCTA* CsA;
CREATESTRUCTW* CsW;
UNICODE_STRING UString;
ANSI_STRING AString;
CsW = (CREATESTRUCTW*)lParam;
CsA = User32AllocHeap(sizeof(CREATESTRUCTA));
memcpy(CsW, CsA, sizeof(CREATESTRUCTW));
RtlInitUnicodeString(&UString, CsW->lpszName);
RtlUnicodeStringToAnsiString(&AString, &UString, TRUE);
CsA->lpszName = AString.Buffer;
RtlInitUnicodeString(&UString, CsW->lpszClass);
RtlUnicodeStringToAnsiString(&AString, &UString, TRUE);
CsA->lpszClass = AString.Buffer;
(*lParam) = (LPARAM)CsA;
break;
}
}
return;
}
VOID STATIC
User32FreeUnicodeConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
{
}
VOID STATIC
User32ConvertToUnicodeMessage(UINT* Msg, WPARAM* wParam, LPARAM* lParam)
{
}
LRESULT STDCALL
CallWindowProcA(WNDPROC lpPrevWndFunc,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
if (IsWindowUnicode(hWnd))
{
LRESULT Result;
User32ConvertToUnicodeMessage(&Msg, &wParam, &lParam);
Result = lpPrevWndFunc(hWnd, Msg, wParam, lParam);
User32FreeUnicodeConvertedMessage(Msg, wParam, lParam);
return(Result);
}
else
{
return(lpPrevWndFunc(hWnd, Msg, wParam, lParam));
}
}
LRESULT STDCALL
CallWindowProcW(WNDPROC lpPrevWndFunc,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
if (!IsWindowUnicode(hWnd))
{
LRESULT Result;
User32ConvertToAsciiMessage(&Msg, &wParam, &lParam);
Result = lpPrevWndFunc(hWnd, Msg, wParam, lParam);
User32FreeAsciiConvertedMessage(Msg, wParam, lParam);
return(Result);
}
else
{
return(lpPrevWndFunc(hWnd, Msg, wParam, lParam));
}
}
@ -323,12 +400,10 @@ SendNotifyMessageW(
return FALSE;
}
WINBOOL
STDCALL
TranslateMessage(
CONST MSG *lpMsg)
WINBOOL STDCALL
TranslateMessage(CONST MSG *lpMsg)
{
return NtUserTranslateMessage((LPMSG)lpMsg, 0);
return(NtUserTranslateMessage((LPMSG)lpMsg, 0));
}
WINBOOL

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.5 2002/05/06 22:20:31 dwelch Exp $
/* $Id: window.c,v 1.6 2002/06/18 21:51:09 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -19,6 +19,30 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL
User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
WNDPROC Proc;
LRESULT Result;
DbgPrint("User32SendCREATEMessageForKernel.\n");
CallbackArgs = (PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS))
{
DbgPrint("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DbgPrint("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0,
(LPARAM)&CallbackArgs->CreateStruct);
DbgPrint("Returning result %d.\n", Result);
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
/* Doesn't return. */
}
NTSTATUS STDCALL
User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
{
@ -26,14 +50,19 @@ User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
WNDPROC Proc;
LRESULT Result;
DbgPrint("User32SendNCCREATEMessageForKernel.\n");
CallbackArgs = (PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS))
{
DbgPrint("Wrong length.\n");
return(STATUS_INFO_LENGTH_MISMATCH);
}
Proc = (WNDPROC)GetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC);
Result = CallWindowProc(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
(LPARAM)&CallbackArgs->CreateStruct);
Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
DbgPrint("Proc %X\n", Proc);
/* Call the window procedure; notice kernel messages are always unicode. */
Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0,
(LPARAM)&CallbackArgs->CreateStruct);
DbgPrint("Returning result %d.\n", Result);
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
/* Doesn't return. */
}
@ -42,7 +71,8 @@ NTSTATUS STDCALL
User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
{
PSENDASYNCPROC_CALLBACK_ARGUMENTS CallbackArgs;
DbgPrint("User32CallSendAsyncProcKernel()\n");
CallbackArgs = (PSENDASYNCPROC_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
{
@ -59,6 +89,7 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
PWINDOWPROC_CALLBACK_ARGUMENTS CallbackArgs;
LRESULT Result;
DbgPrint("User32CallWindowProcFromKernel()\n");
CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS)Arguments;
if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
{
@ -69,9 +100,10 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
CallbackArgs->Proc = (WNDPROC)GetWindowLong(CallbackArgs->Wnd,
GWL_WNDPROC);
}
Result = CallWindowProc(CallbackArgs->Proc, CallbackArgs->Wnd,
CallbackArgs->Msg, CallbackArgs->wParam,
CallbackArgs->lParam);
DbgPrint("CallbackArgs->Proc %X\n", CallbackArgs->Proc);
Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd,
CallbackArgs->Msg, CallbackArgs->wParam,
CallbackArgs->lParam);
ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
/* Doesn't return. */
}

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.70 2002/06/10 08:45:40 ekohl Exp $
# $Id: Makefile,v 1.71 2002/06/18 21:51:09 dwelch Exp $
#
# ReactOS Operating System
#
@ -220,7 +220,8 @@ OBJECTS_PS = \
ps/tinfo.o \
ps/debug.o \
ps/suspend.o \
ps/win32.o
ps/win32.o \
ps/w32call.o
# Executive Subsystem (Ex)
OBJECTS_EX = \
@ -629,13 +630,15 @@ bugcodes.rc: ntoskrnl.mc
-o bugcodes.rc \
$(TARGETNAME).mc
implib:
$(DDK_PATH_LIB)/$(TARGETNAME).a: $(TARGETNAME).def
- $(DLLTOOL) \
--dllname $(TARGETNAME).exe \
--def $(TARGETNAME).def \
--output-lib $(DDK_PATH_LIB)/$(TARGETNAME).a \
--kill-at
implib: $(DDK_PATH_LIB)/$(TARGETNAME).a
clean:
- $(RM) $(CLEAN_FILES)

View file

@ -208,8 +208,7 @@ Ki386InitializeLdt(VOID);
ULONG
KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
VOID STDCALL
KePushAndStackSwitchAndSysRet(ULONG A, ULONG B, ULONG C, ULONG D, ULONG E,
ULONG F, PVOID NewStack);
KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack);
VOID STDCALL
KeStackSwitchAndRet(PVOID NewStack);
VOID STDCALL

View file

@ -32,6 +32,12 @@
/* FUNCTIONS ****************************************************************/
/*
* FUNCTION: KeStackSwitchAndRet
* PURPOSE: Switch to a new stack and return from the first frame on
* the new stack which was assumed to a stdcall function with
* 8 bytes of arguments and which saved edi, esi and ebx.
*/
.globl _KeStackSwitchAndRet@4
_KeStackSwitchAndRet@4:
pushl %ebp
@ -48,10 +54,10 @@ _KeStackSwitchAndRet@4:
popl %ebx
popl %ebp
ret $28
ret $8
.globl _KePushAndStackSwitchAndSysRet@28
_KePushAndStackSwitchAndSysRet@28:
.globl _KePushAndStackSwitchAndSysRet@8
_KePushAndStackSwitchAndSysRet@8:
pushl %ebp
movl %esp, %ebp
@ -62,15 +68,10 @@ _KePushAndStackSwitchAndSysRet@28:
cli
pushl 8(%ebp)
pushl 12(%ebp)
pushl 16(%ebp)
pushl 20(%ebp)
pushl 24(%ebp)
pushl 28(%ebp)
movl %fs:KPCR_CURRENT_THREAD, %ebx
movl %esp, KTHREAD_CALLBACK_STACK(%ebx)
movl 32(%ebp), %esp
movl 12(%ebp), %esp
sti

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.97 2002/06/16 21:41:16 dwelch Exp $
/* $Id: thread.c,v 1.98 2002/06/18 21:51:10 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -517,187 +517,6 @@ NtOpenThread(OUT PHANDLE ThreadHandle,
UNIMPLEMENTED;
}
NTSTATUS STDCALL
NtCallbackReturn (PVOID Result,
ULONG ResultLength,
NTSTATUS Status)
{
PULONG OldStack;
PETHREAD Thread;
PNTSTATUS CallbackStatus;
PULONG CallerResultLength;
PVOID* CallerResult;
PVOID InitialStack;
PVOID StackBase;
ULONG StackLimit;
KIRQL oldIrql;
Thread = PsGetCurrentThread();
OldStack = (PULONG)Thread->Tcb.CallbackStack;
Thread->Tcb.CallbackStack = NULL;
CallbackStatus = (PNTSTATUS)OldStack[0];
CallerResultLength = (PULONG)OldStack[1];
CallerResult = (PVOID*)OldStack[2];
InitialStack = (PVOID)OldStack[3];
StackBase = (PVOID)OldStack[4];
StackLimit = OldStack[5];
*CallbackStatus = Status;
if (CallerResult != NULL && CallerResultLength != NULL)
{
if (Result == NULL)
{
*CallerResultLength = 0;
}
else
{
*CallerResultLength = min(ResultLength, *CallerResultLength);
memcpy(*CallerResult, Result, *CallerResultLength);
}
}
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
Thread->Tcb.InitialStack = InitialStack;
Thread->Tcb.StackBase = StackBase;
Thread->Tcb.StackLimit = StackLimit;
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack;
KeStackSwitchAndRet((PVOID)(OldStack + 6));
/* Should never return. */
KeBugCheck(0);
return(STATUS_UNSUCCESSFUL);
}
VOID STATIC
PsFreeCallbackStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
BOOLEAN Dirty)
{
assert(SwapEntry == 0);
if (PhysAddr.QuadPart != 0)
{
MmReleasePageMemoryConsumer(MC_NPPOOL, PhysAddr);
}
}
VOID STATIC
PsFreeCallbackStack(PVOID StackLimit)
{
MmLockAddressSpace(MmGetKernelAddressSpace());
MmFreeMemoryArea(MmGetKernelAddressSpace(),
StackLimit,
MM_STACK_SIZE,
PsFreeCallbackStackPage,
NULL);
MmUnlockAddressSpace(MmGetKernelAddressSpace());
}
PVOID STATIC
PsAllocateCallbackStack(ULONG StackSize)
{
PVOID KernelStack = NULL;
NTSTATUS Status;
PMEMORY_AREA StackArea;
ULONG i;
StackSize = PAGE_ROUND_UP(StackSize);
MmLockAddressSpace(MmGetKernelAddressSpace());
Status = MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_KERNEL_STACK,
&KernelStack,
StackSize,
0,
&StackArea,
FALSE);
MmUnlockAddressSpace(MmGetKernelAddressSpace());
if (!NT_SUCCESS(Status))
{
DPRINT("Failed to create thread stack\n");
return(NULL);
}
for (i = 0; i < (StackSize / PAGESIZE); i++)
{
PHYSICAL_ADDRESS Page;
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &Page);
if (!NT_SUCCESS(Status))
{
return(NULL);
}
Status = MmCreateVirtualMapping(NULL,
KernelStack + (i * PAGESIZE),
PAGE_EXECUTE_READWRITE,
Page,
TRUE);
}
return(KernelStack);
}
NTSTATUS STDCALL
NtW32Call (IN ULONG RoutineIndex,
IN PVOID Argument,
IN ULONG ArgumentLength,
OUT PVOID* Result OPTIONAL,
OUT PULONG ResultLength OPTIONAL)
{
PETHREAD Thread;
PVOID NewStack;
ULONG StackSize;
PKTRAP_FRAME NewFrame;
PULONG UserEsp;
KIRQL oldIrql;
ULONG SavedStackLimit;
PVOID SavedStackBase;
PVOID SavedInitialStack;
NTSTATUS CallbackStatus;
Thread = PsGetCurrentThread();
if (Thread->Tcb.CallbackStack != NULL)
{
return(STATUS_UNSUCCESSFUL);
}
/* Set up the new kernel and user environment. */
StackSize = (ULONG)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
NewStack = PsAllocateCallbackStack(StackSize);
/* FIXME: Need to check whether we were interrupted from v86 mode. */
memcpy(NewStack + StackSize - sizeof(KTRAP_FRAME), Thread->Tcb.TrapFrame,
sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD)));
NewFrame = (PKTRAP_FRAME)(NewStack + StackSize - sizeof(KTRAP_FRAME));
NewFrame->Esp -= (ArgumentLength + (4 * sizeof(ULONG)));
NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher();
UserEsp = (PULONG)NewFrame->Esp;
UserEsp[0] = 0; /* Return address. */
UserEsp[1] = RoutineIndex;
UserEsp[2] = (ULONG)&UserEsp[4];
UserEsp[3] = ArgumentLength;
memcpy((PVOID)&UserEsp[4], Argument, ArgumentLength);
/* Switch to the new environment and return to user-mode. */
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
SavedStackLimit = Thread->Tcb.StackLimit;
SavedStackBase = Thread->Tcb.StackBase;
SavedInitialStack = Thread->Tcb.InitialStack;
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = NewStack + StackSize;
Thread->Tcb.StackLimit = (ULONG)NewStack;
Thread->Tcb.KernelStack = NewStack + StackSize - sizeof(KTRAP_FRAME);
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack;
KePushAndStackSwitchAndSysRet(SavedStackLimit,
(ULONG)SavedStackBase,
(ULONG)SavedInitialStack, (ULONG)Result,
(ULONG)ResultLength, (ULONG)&CallbackStatus,
Thread->Tcb.KernelStack);
/*
* The callback return will have already restored most of the state we
* modified.
*/
KeLowerIrql(PASSIVE_LEVEL);
PsFreeCallbackStack(NewStack);
return(CallbackStatus);
}
NTSTATUS STDCALL
NtContinue(IN PCONTEXT Context,
IN BOOLEAN TestAlert)

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.44 2002/06/11 22:09:03 dwelch Exp $
# $Id: makefile,v 1.45 2002/06/18 21:51:10 dwelch Exp $
PATH_TO_TOP = ../..
@ -71,6 +71,8 @@ include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
main/dllmain.o: main/svctab.c
.dummy:
%/TAGS: .dummy

View file

@ -1,4 +1,4 @@
/* $Id: object.c,v 1.3 2002/01/27 03:25:45 dwelch Exp $
/* $Id: object.c,v 1.4 2002/06/18 21:51:10 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -367,7 +367,8 @@ ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
}
ObmpLockHandleTable(HandleTable);
Handle = 1;
Current = HandleTable->ListHead.Flink;
/*
* Scan through the currently allocated Handle blocks looking for a free
@ -377,8 +378,7 @@ ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
{
PUSER_HANDLE_BLOCK Block =
CONTAINING_RECORD(Current, USER_HANDLE_BLOCK, ListEntry);
Handle = 1;
for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
{
if (!Block->Handles[i].ObjectBody)

View file

@ -1,4 +1,4 @@
/* $Id: callback.c,v 1.2 2002/05/06 22:20:32 dwelch Exp $
/* $Id: callback.c,v 1.3 2002/06/18 21:51:11 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -43,6 +43,26 @@ W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, RECT Rect1,
LRESULT STDCALL
W32kSendCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct)
{
SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
LRESULT Result;
NTSTATUS Status;
PVOID ResultPointer;
DWORD ResultLength;
Arguments.Wnd = Wnd;
Arguments.CreateStruct = *CreateStruct;
ResultPointer = &Result;
ResultLength = sizeof(LRESULT);
Status = NtW32Call(USER32_CALLBACK_SENDCREATE,
&Arguments,
sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS),
&ResultPointer,
&ResultLength);
if (!NT_SUCCESS(Status))
{
return(0);
}
return(Result);
}
LRESULT STDCALL
@ -58,9 +78,9 @@ W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct)
Arguments.CreateStruct = *CreateStruct;
ResultPointer = &Result;
ResultLength = sizeof(LRESULT);
Status = NtW32Call(USER32_CALLBACK_WINDOWPROC,
Status = NtW32Call(USER32_CALLBACK_SENDNCCREATE,
&Arguments,
sizeof(WINDOWPROC_CALLBACK_ARGUMENTS),
sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS),
&ResultPointer,
&ResultLength);
if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.6 2002/05/06 22:20:32 dwelch Exp $
/* $Id: window.c,v 1.7 2002/06/18 21:51:11 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -22,7 +22,7 @@
#include <include/callback.h>
#include <include/msgqueue.h>
#define NDEBUG
//#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
@ -105,7 +105,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
POINT MaxSize, MaxPos, MinTrack, MaxTrack;
CREATESTRUCT Cs;
LRESULT Result;
DPRINT("NtUserCreateWindowEx\n");
/* Initialize gui state if necessary. */
W32kGuiCheck();
if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer))
@ -142,6 +145,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
WindowObject = (PWINDOW_OBJECT)
ObmCreateObject(PsGetWin32Process()->HandleTable, &Handle, otWindow,
sizeof(WINDOW_OBJECT));
DPRINT("Created object with handle %X\n", Handle);
if (!WindowObject)
{
ObDereferenceObject(WinStaObject);
@ -246,16 +250,19 @@ NtUserCreateWindowEx(DWORD dwExStyle,
Cs.lpszName = lpWindowName->Buffer;
Cs.lpszClass = lpClassName->Buffer;
Cs.dwExStyle = dwExStyle;
DPRINT("NtUserCreateWindowEx(): About to send NCCREATE message.\n");
Result = W32kSendNCCREATEMessage(WindowObject->Self, &Cs);
if (!Result)
{
/* FIXME: Cleanup. */
DPRINT("NtUserCreateWindowEx(): NCCREATE message failed.\n");
return(NULL);
}
/* Calculate the non-client size. */
MaxPos.x = WindowObject->WindowRect.left;
MaxPos.y = WindowObject->WindowRect.top;
DPRINT("NtUserCreateWindowEx(): About to get non-client size.\n");
Result = WinPosGetNonClientSize(WindowObject->Self,
&WindowObject->WindowRect,
&WindowObject->ClientRect);
@ -264,10 +271,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
MaxPos.y - WindowObject->WindowRect.top);
/* Send the CREATE message. */
DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n");
Result = W32kSendCREATEMessage(WindowObject->Self, &Cs);
if (!Result)
if (Result == (LRESULT)-1)
{
/* FIXME: Cleanup. */
DPRINT("NtUserCreateWindowEx(): send CREATE message failed.\n");
return(NULL);
}
@ -281,11 +290,13 @@ NtUserCreateWindowEx(DWORD dwExStyle,
WindowObject->ClientRect.left,
WindowObject->ClientRect.bottom -
WindowObject->ClientRect.top);
DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n");
W32kCallWindowProc(NULL, WindowObject->Self, WM_SIZE, SIZE_RESTORED,
lParam);
lParam =
MAKE_LONG(WindowObject->ClientRect.left,
WindowObject->ClientRect.top);
DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n");
W32kCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam);
}
@ -302,6 +313,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
((WindowObject->Style & WS_CHILD) || W32kGetActiveWindow()) ?
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED :
SWP_NOZORDER | SWP_FRAMECHANGED;
DPRINT("NtUserCreateWindow(): About to minimize/maximize\n");
WinPosSetWindowPos(WindowObject->Self, 0, NewPos.left, NewPos.top,
NewPos.right, NewPos.bottom, SwFlag);
}
@ -310,6 +322,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
if ((WindowObject->Style & WS_CHILD) ||
(!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
{
DPRINT("NtUserCreateWindow(): About to notify parent\n");
W32kCallWindowProc(NULL, WindowObject->Parent->Self,
WM_PARENTNOTIFY,
MAKEWPARAM(WM_CREATE, WindowObject->IDMenu),
@ -318,9 +331,11 @@ NtUserCreateWindowEx(DWORD dwExStyle,
if (dwStyle & WS_VISIBLE)
{
DPRINT("NtUserCreateWindow(): About to show window\n");
WinPosShowWindow(WindowObject->Self, dwShowMode);
}
DPRINT("NtUserCreateWindow(): = %X\n", Handle);
return((HWND)Handle);
}
@ -616,6 +631,60 @@ NtUserSetWindowFNID(DWORD Unknown0,
return 0;
}
DWORD STDCALL
NtUserGetWindowLong(HWND hWnd, DWORD Index)
{
PWINDOW_OBJECT WindowObject;
NTSTATUS Status;
DWORD Result;
DPRINT("NtUserGetWindowLong(hWnd %X, Index %d)\n", hWnd, Index);
W32kGuiCheck();
Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
hWnd,
otWindow,
(PVOID*)&WindowObject);
if (!NT_SUCCESS(Status))
{
DPRINT("NtUserGetWindowLong(): Bad handle.\n");
return(0);
}
switch (Index)
{
case GWL_EXSTYLE:
{
Result = (DWORD)WindowObject->ExStyle;
break;
}
case GWL_STYLE:
{
Result = (DWORD)WindowObject->Style;
break;
}
case GWL_WNDPROC:
{
Result = (DWORD)WindowObject->Class->Class.lpfnWndProc;
break;
}
default:
{
DPRINT1("NtUserGetWindowLong(): Unsupported index %d\n", Index);
Result = 0;
break;
}
}
ObmDereferenceObject(WindowObject);
DPRINT("NtUserGetWindowLong(): %X\n", Result);
return(Result);
}
DWORD STDCALL
NtUserSetWindowLong(DWORD Unknown0,
DWORD Unknown1,

View file

@ -1,4 +1,4 @@
# $Id: helper.mk,v 1.16 2002/06/16 21:41:16 dwelch Exp $
# $Id: helper.mk,v 1.17 2002/06/18 21:51:11 dwelch Exp $
#
# Helper makefile for ReactOS modules
# Variables this makefile accepts:
@ -539,12 +539,16 @@ endif # MK_IMPLIBONLY
$(MK_FULLRES): $(PATH_TO_TOP)/include/reactos/buildno.h $(TARGET_PATH)/$(MK_RES_BASE).rc
implib:
ifeq ($(MK_IMPLIB),yes)
$(MK_IMPLIBPATH)/$(MK_BASENAME).a: $(MK_DEFNAME)
$(DLLTOOL) --dllname $(MK_FULLNAME) \
--def $(MK_DEFNAME) \
--output-lib $(MK_IMPLIBPATH)/$(MK_BASENAME).a \
--kill-at
implib: $(MK_IMPLIBPATH)/$(MK_BASENAME).a
else
implib:
endif
# Be carefull not to clean non-object files