2003-12-07 Casper S. Hornstrup <chorns@users.sourceforge.net>

* subsys/win32k/include/accelerator.h: New file.
	* subsys/win32k/ntuser/accelerator.c: Ditto.
	* include/win32k/ntuser.h (NtUserDestroyAcceleratorTable): Make returntype
	BOOLEAN.
	* subsys/win32k/makefile (NTUSER_OBJECTS): Add ntuser/accelerator.o.
	* subsys/win32k/include/object.h (USER_OBJECT_TYPE): Add otAcceleratorTable.
	* subsys/win32k/main/dllmain.c (DllMain): Call InitAcceleratorImpl().
	* subsys/win32k/ntuser/stubs.c (NtUserCopyAcceleratorTable,
	NtUserCreateAcceleratorTable, NtUserDestroyAcceleratorTable,
	NtUserTranslateAccelerator): Move to accelerator.c.

svn path=/trunk/; revision=6892
This commit is contained in:
Casper Hornstrup 2003-12-07 12:59:34 +00:00
parent 22e15cb2f5
commit 5efa33af96
8 changed files with 263 additions and 54 deletions

View file

@ -1,3 +1,16 @@
2003-12-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/win32k/include/accelerator.h: New file.
* subsys/win32k/ntuser/accelerator.c: Ditto.
* include/win32k/ntuser.h (NtUserDestroyAcceleratorTable): Make returntype
BOOLEAN.
* subsys/win32k/makefile (NTUSER_OBJECTS): Add ntuser/accelerator.o.
* subsys/win32k/include/object.h (USER_OBJECT_TYPE): Add otAcceleratorTable.
* subsys/win32k/main/dllmain.c (DllMain): Call InitAcceleratorImpl().
* subsys/win32k/ntuser/stubs.c (NtUserCopyAcceleratorTable,
NtUserCreateAcceleratorTable, NtUserDestroyAcceleratorTable,
NtUserTranslateAccelerator): Move to accelerator.c.
2003-12-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
* apps/tests/accelerator: New directory.

View file

@ -265,7 +265,7 @@ NtUserCountClipboardFormats(VOID);
HACCEL
STDCALL
NtUserCreateAcceleratorTable(
LPACCEL Entries,
LPACCEL Entries,
SIZE_T EntriesCount);
BOOL
@ -373,7 +373,7 @@ NtUserDeleteMenu(
UINT uPosition,
UINT uFlags);
BOOL
BOOLEAN
STDCALL
NtUserDestroyAcceleratorTable(
HACCEL Table);

View file

@ -0,0 +1,24 @@
#ifndef _WIN32K_ACCELERATOR_H
#define _WIN32K_ACCELERATOR_H
#include <windows.h>
#include <ddk/ntddk.h>
#include <include/winsta.h>
#include <include/window.h>
typedef struct _ACCELERATOR_TABLE
{
int Count;
LPACCEL Table;
} ACCELERATOR_TABLE, *PACCELERATOR_TABLE;
NTSTATUS FASTCALL
InitAcceleratorImpl();
NTSTATUS FASTCALL
CleanupAcceleratorImpl();
VOID
RegisterThreadAcceleratorTable(struct _ETHREAD *Thread);
#endif /* _WIN32K_ACCELERATOR_H */

View file

@ -10,7 +10,8 @@ typedef enum {
otUnknown = 0,
otClass,
otWindow,
otMenu
otMenu,
otAcceleratorTable,
} USER_OBJECT_TYPE;
typedef struct _USER_OBJECT_HEADER

View file

@ -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: dllmain.c,v 1.56 2003/12/03 21:50:50 gvg Exp $
/* $Id: dllmain.c,v 1.57 2003/12/07 12:59:34 chorns Exp $
*
* Entry Point for win32k.sys
*/
@ -40,6 +40,7 @@
#include <include/text.h>
#include <include/caret.h>
#include <include/hotkey.h>
#include <include/accelerator.h>
#include <include/guicheck.h>
#define NDEBUG
@ -271,6 +272,13 @@ DllMain (
return(Status);
}
Status = InitAcceleratorImpl();
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to initialize accelerator implementation.\n");
return(Status);
}
InitGdiObjectHandleTable ();
/* Initialize FreeType library */

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.85 2003/12/06 23:10:50 mf Exp $
# $Id: makefile,v 1.86 2003/12/07 12:59:34 chorns Exp $
PATH_TO_TOP = ../..
@ -48,7 +48,7 @@ MISC_OBJECTS = misc/driver.o misc/error.o misc/math.o misc/object.o
LDR_OBJECTS = ldr/loader.o
NTUSER_OBJECTS = ntuser/callback.o ntuser/caret.o ntuser/class.o ntuser/focus.o \
NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/class.o ntuser/focus.o \
ntuser/guicheck.o ntuser/hook.o ntuser/hotkey.o ntuser/input.o \
ntuser/keyboard.o ntuser/menu.o ntuser/message.o ntuser/metric.o \
ntuser/misc.o ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o \

View file

@ -0,0 +1,210 @@
/*
* ReactOS W32 Subsystem
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: accelerator.c,v 1.1 2003/12/07 12:59:34 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Window classes
* FILE: subsys/win32k/ntuser/class.c
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* REVISION HISTORY:
* 06-06-2001 CSH Created
*/
/* INCLUDES ******************************************************************/
#include <roskrnl.h>
#include <win32k/win32k.h>
#include <internal/safe.h>
#include <napi/win32.h>
#include <include/error.h>
#include <include/winsta.h>
#include <include/object.h>
#include <include/guicheck.h>
#include <include/window.h>
#include <include/accelerator.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
NTSTATUS FASTCALL
InitAcceleratorImpl(VOID)
{
return(STATUS_SUCCESS);
}
NTSTATUS FASTCALL
CleanupAcceleratorImpl(VOID)
{
return(STATUS_SUCCESS);
}
int
STDCALL
NtUserCopyAcceleratorTable(
HACCEL Table,
LPACCEL Entries,
int EntriesCount)
{
UNIMPLEMENTED
return 0;
}
HACCEL
STDCALL
NtUserCreateAcceleratorTable(
LPACCEL Entries,
SIZE_T EntriesCount)
{
PWINSTATION_OBJECT WindowStation;
PACCELERATOR_TABLE AcceleratorTable;
NTSTATUS Status;
HACCEL Handle;
DbgPrint("NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n",
Entries, EntriesCount);
Status = IntValidateWindowStationHandle(NtUserGetProcessWindowStation(),
UserMode,
0,
&WindowStation);
if (!NT_SUCCESS(Status))
{
SetLastNtError(STATUS_ACCESS_DENIED);
DbgPrint("E1\n");
return FALSE;
}
AcceleratorTable = ObmCreateObject(
WindowStation->HandleTable,
(PHANDLE)&Handle,
otAcceleratorTable,
sizeof(ACCELERATOR_TABLE));
if (AcceleratorTable == NULL)
{
ObDereferenceObject(WindowStation);
SetLastNtError(STATUS_NO_MEMORY);
DbgPrint("E2\n");
return (HACCEL) 0;
}
AcceleratorTable->Count = EntriesCount;
if (AcceleratorTable->Count > 0)
{
AcceleratorTable->Table = ExAllocatePool(PagedPool, EntriesCount * sizeof(ACCEL));
if (AcceleratorTable->Table == NULL)
{
ObmCloseHandle(WindowStation->HandleTable, Handle);
ObDereferenceObject(WindowStation);
SetLastNtError(Status);
DbgPrint("E3\n");
return (HACCEL) 0;
}
Status = MmCopyFromCaller(AcceleratorTable->Table, Entries, EntriesCount * sizeof(ACCEL));
if (!NT_SUCCESS(Status))
{
ExFreePool(AcceleratorTable->Table);
ObmCloseHandle(WindowStation->HandleTable, Handle);
ObDereferenceObject(WindowStation);
SetLastNtError(Status);
DbgPrint("E4\n");
return (HACCEL) 0;
}
}
ObDereferenceObject(WindowStation);
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
DbgPrint("NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) = %x end\n",
Entries, EntriesCount, Handle);
return (HACCEL) Handle;
}
BOOLEAN
STDCALL
NtUserDestroyAcceleratorTable(
HACCEL Table)
{
PWINSTATION_OBJECT WindowStation;
PACCELERATOR_TABLE AcceleratorTable;
NTSTATUS Status;
HACCEL Handle;
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
usage count (and return TRUE).
FIXME: Destroy only tables created using CreateAcceleratorTable.
*/
DbgPrint("NtUserDestroyAcceleratorTable(Table %x)\n",
Table);
Status = IntValidateWindowStationHandle(NtUserGetProcessWindowStation(),
UserMode,
0,
&WindowStation);
if (!NT_SUCCESS(Status))
{
SetLastNtError(STATUS_ACCESS_DENIED);
DbgPrint("E1\n");
return FALSE;
}
Status = ObmReferenceObjectByHandle(WindowStation->HandleTable,
Table,
otAcceleratorTable,
(PVOID*)&AcceleratorTable);
if (!NT_SUCCESS(Status))
{
SetLastNtError(STATUS_INVALID_HANDLE);
ObDereferenceObject(WindowStation);
DbgPrint("E2\n");
return FALSE;
}
if (AcceleratorTable->Table != NULL)
{
ExFreePool(AcceleratorTable->Table);
}
ObmCloseHandle(WindowStation->HandleTable, Handle);
ObDereferenceObject(WindowStation);
DbgPrint("NtUserDestroyAcceleratorTable(Table %x)\n",
Table);
return TRUE;
}
int
STDCALL
NtUserTranslateAccelerator(
HWND Window,
HACCEL Table,
LPMSG Message)
{
UNIMPLEMENTED
return 0;
}

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.40 2003/11/30 20:03:47 navaraf Exp $
/* $Id: stubs.c,v 1.41 2003/12/07 12:59:34 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -156,18 +156,6 @@ NtUserConvertMemHandle(
return 0;
}
DWORD
STDCALL
NtUserCopyAcceleratorTable(
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2)
{
UNIMPLEMENTED
return 0;
}
DWORD
STDCALL
NtUserCountClipboardFormats(VOID)
@ -177,18 +165,6 @@ NtUserCountClipboardFormats(VOID)
return 0;
}
DWORD
STDCALL
NtUserCreateAcceleratorTable(
DWORD Unknown0,
DWORD Unknown1)
{
/* UNIMPLEMENTED */
DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__);
return 0;
}
DWORD
STDCALL
NtUserCreateLocalMemHandle(
@ -240,17 +216,6 @@ NtUserDdeSetQualityOfService(
return 0;
}
DWORD
STDCALL
NtUserDestroyAcceleratorTable(
DWORD Unknown0)
{
UNIMPLEMENTED
return 0;
}
DWORD
STDCALL
NtUserDragObject(
@ -892,18 +857,6 @@ NtUserTrackMouseEvent(
return 0;
}
DWORD
STDCALL
NtUserTranslateAccelerator(
DWORD Unknown0,
DWORD Unknown1,
DWORD Unknown2)
{
UNIMPLEMENTED
return 0;
}
DWORD
STDCALL
NtUserUnloadKeyboardLayout(