Commit 9759ed14 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move accelerators object implementation from user32.

parent e58b561c
...@@ -5705,12 +5705,12 @@ INT WINAPI TranslateAcceleratorW( HWND hWnd, HACCEL hAccel, LPMSG msg ) ...@@ -5705,12 +5705,12 @@ INT WINAPI TranslateAcceleratorW( HWND hWnd, HACCEL hAccel, LPMSG msg )
TRACE_(accel)("hAccel %p, hWnd %p, msg->hwnd %p, msg->message %04x, wParam %08lx, lParam %08lx\n", TRACE_(accel)("hAccel %p, hWnd %p, msg->hwnd %p, msg->message %04x, wParam %08lx, lParam %08lx\n",
hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam); hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam);
if (!(count = CopyAcceleratorTableW( hAccel, NULL, 0 ))) return 0; if (!(count = NtUserCopyAcceleratorTable( hAccel, NULL, 0 ))) return 0;
if (count > ARRAY_SIZE( data )) if (count > ARRAY_SIZE( data ))
{ {
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*ptr) ))) return 0; if (!(ptr = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*ptr) ))) return 0;
} }
count = CopyAcceleratorTableW( hAccel, ptr, count ); count = NtUserCopyAcceleratorTable( hAccel, ptr, count );
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (translate_accelerator( hWnd, msg->message, msg->wParam, msg->lParam, if (translate_accelerator( hWnd, msg->message, msg->wParam, msg->lParam,
......
...@@ -23,11 +23,9 @@ ...@@ -23,11 +23,9 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winerror.h"
#include "winternl.h"
#include "winnls.h" #include "winnls.h"
#include "ntuser.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "user_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(resource); WINE_DEFAULT_DEBUG_CHANNEL(resource);
WINE_DECLARE_DEBUG_CHANNEL(accel); WINE_DECLARE_DEBUG_CHANNEL(accel);
...@@ -41,14 +39,6 @@ typedef struct ...@@ -41,14 +39,6 @@ typedef struct
WORD pad; WORD pad;
} PE_ACCEL; } PE_ACCEL;
/* the accelerator user object */
struct accelerator
{
struct user_object obj;
unsigned int count;
ACCEL table[1];
};
/********************************************************************** /**********************************************************************
* LoadAcceleratorsW (USER32.@) * LoadAcceleratorsW (USER32.@)
*/ */
...@@ -73,7 +63,7 @@ HACCEL WINAPI LoadAcceleratorsW(HINSTANCE instance, LPCWSTR name) ...@@ -73,7 +63,7 @@ HACCEL WINAPI LoadAcceleratorsW(HINSTANCE instance, LPCWSTR name)
table[i].key = pe_table[i].key; table[i].key = pe_table[i].key;
table[i].cmd = pe_table[i].cmd; table[i].cmd = pe_table[i].cmd;
} }
handle = CreateAcceleratorTableW( table, count ); handle = NtUserCreateAcceleratorTable( table, count );
HeapFree( GetProcessHeap(), 0, table ); HeapFree( GetProcessHeap(), 0, table );
TRACE_(accel)("%p %s returning %p\n", instance, debugstr_w(name), handle ); TRACE_(accel)("%p %s returning %p\n", instance, debugstr_w(name), handle );
return handle; return handle;
...@@ -106,7 +96,7 @@ HACCEL WINAPI LoadAcceleratorsA(HINSTANCE instance,LPCSTR lpTableName) ...@@ -106,7 +96,7 @@ HACCEL WINAPI LoadAcceleratorsA(HINSTANCE instance,LPCSTR lpTableName)
INT WINAPI CopyAcceleratorTableA(HACCEL src, LPACCEL dst, INT count) INT WINAPI CopyAcceleratorTableA(HACCEL src, LPACCEL dst, INT count)
{ {
char ch; char ch;
int i, ret = CopyAcceleratorTableW( src, dst, count ); int i, ret = NtUserCopyAcceleratorTable( src, dst, count );
if (ret && dst) if (ret && dst)
{ {
...@@ -120,35 +110,6 @@ INT WINAPI CopyAcceleratorTableA(HACCEL src, LPACCEL dst, INT count) ...@@ -120,35 +110,6 @@ INT WINAPI CopyAcceleratorTableA(HACCEL src, LPACCEL dst, INT count)
return ret; return ret;
} }
/**********************************************************************
* CopyAcceleratorTableW (USER32.@)
*/
INT WINAPI CopyAcceleratorTableW(HACCEL src, LPACCEL dst, INT count)
{
struct accelerator *accel;
int i;
if (!(accel = get_user_handle_ptr( src, NTUSER_OBJ_ACCEL ))) return 0;
if (accel == OBJ_OTHER_PROCESS)
{
FIXME( "other process handle %p?\n", src );
return 0;
}
if (dst)
{
if (count > accel->count) count = accel->count;
for (i = 0; i < count; i++)
{
dst[i].fVirt = accel->table[i].fVirt & 0x7f;
dst[i].key = accel->table[i].key;
dst[i].cmd = accel->table[i].cmd;
}
}
else count = accel->count;
release_user_handle_ptr( accel );
return count;
}
/********************************************************************* /*********************************************************************
* CreateAcceleratorTableA (USER32.@) * CreateAcceleratorTableA (USER32.@)
*/ */
...@@ -176,60 +137,12 @@ HACCEL WINAPI CreateAcceleratorTableA( ACCEL *accel, INT count ) ...@@ -176,60 +137,12 @@ HACCEL WINAPI CreateAcceleratorTableA( ACCEL *accel, INT count )
} }
else table[i].key = accel[i].key; else table[i].key = accel[i].key;
} }
handle = CreateAcceleratorTableW( table, count ); handle = NtUserCreateAcceleratorTable( table, count );
HeapFree( GetProcessHeap(), 0, table ); HeapFree( GetProcessHeap(), 0, table );
TRACE_(accel)("returning %p\n", handle ); TRACE_(accel)("returning %p\n", handle );
return handle; return handle;
} }
/*********************************************************************
* CreateAcceleratorTableW (USER32.@)
*/
HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccel, INT count)
{
struct accelerator *accel;
HACCEL handle;
if (count < 1)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
accel = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct accelerator, table[count] ));
if (!accel) return 0;
accel->count = count;
memcpy( accel->table, lpaccel, count * sizeof(*lpaccel) );
if (!(handle = alloc_user_handle( &accel->obj, NTUSER_OBJ_ACCEL )))
HeapFree( GetProcessHeap(), 0, accel );
TRACE_(accel)("returning %p\n", handle );
return handle;
}
/******************************************************************************
* DestroyAcceleratorTable [USER32.@]
* Destroys an accelerator table
*
* PARAMS
* handle [I] Handle to accelerator table
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI DestroyAcceleratorTable( HACCEL handle )
{
struct accelerator *accel;
if (!(accel = free_user_handle( handle, NTUSER_OBJ_ACCEL ))) return FALSE;
if (accel == OBJ_OTHER_PROCESS)
{
FIXME( "other process handle %p?\n", accel );
return FALSE;
}
return HeapFree( GetProcessHeap(), 0, accel );
}
/********************************************************************** /**********************************************************************
* LoadStringW (USER32.@) * LoadStringW (USER32.@)
*/ */
......
...@@ -79,13 +79,13 @@ ...@@ -79,13 +79,13 @@
@ stdcall CloseWindow(long) @ stdcall CloseWindow(long)
@ stdcall CloseWindowStation(long) NtUserCloseWindowStation @ stdcall CloseWindowStation(long) NtUserCloseWindowStation
@ stdcall CopyAcceleratorTableA(long ptr long) @ stdcall CopyAcceleratorTableA(long ptr long)
@ stdcall CopyAcceleratorTableW(long ptr long) @ stdcall CopyAcceleratorTableW(long ptr long) NtUserCopyAcceleratorTable
@ stdcall CopyIcon(long) @ stdcall CopyIcon(long)
@ stdcall CopyImage(long long long long long) @ stdcall CopyImage(long long long long long)
@ stdcall CopyRect(ptr ptr) @ stdcall CopyRect(ptr ptr)
@ stdcall CountClipboardFormats() NtUserCountClipboardFormats @ stdcall CountClipboardFormats() NtUserCountClipboardFormats
@ stdcall CreateAcceleratorTableA(ptr long) @ stdcall CreateAcceleratorTableA(ptr long)
@ stdcall CreateAcceleratorTableW(ptr long) @ stdcall CreateAcceleratorTableW(ptr long) NtUserCreateAcceleratorTable
@ stdcall CreateCaret(long long long long) @ stdcall CreateCaret(long long long long)
@ stdcall CreateCursor(long long long long long ptr ptr) @ stdcall CreateCursor(long long long long long ptr ptr)
@ stdcall CreateDesktopA(str str ptr long long ptr) @ stdcall CreateDesktopA(str str ptr long long ptr)
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
@ stdcall DeferWindowPos(long long long long long long long long) @ stdcall DeferWindowPos(long long long long long long long long)
@ stdcall DeleteMenu(long long long) @ stdcall DeleteMenu(long long long)
@ stdcall DeregisterShellHookWindow (long) @ stdcall DeregisterShellHookWindow (long)
@ stdcall DestroyAcceleratorTable(long) @ stdcall DestroyAcceleratorTable(long) NtUserDestroyAcceleratorTable
@ stdcall DestroyCaret() @ stdcall DestroyCaret()
@ stdcall DestroyCursor(long) @ stdcall DestroyCursor(long)
@ stdcall DestroyIcon(long) @ stdcall DestroyIcon(long)
......
...@@ -32,6 +32,7 @@ C_SRCS = \ ...@@ -32,6 +32,7 @@ C_SRCS = \
input.c \ input.c \
main.c \ main.c \
mapping.c \ mapping.c \
menu.c \
message.c \ message.c \
opentype.c \ opentype.c \
painting.c \ painting.c \
......
/*
* Menu functions
*
* Copyright 1993 Robert J. Amstadt
* Copyright 1995, 2009 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include "win32u_private.h"
#include "ntuser_private.h"
#include "wine/debug.h"
WINE_DECLARE_DEBUG_CHANNEL(accel);
/* the accelerator user object */
struct accelerator
{
struct user_object obj;
unsigned int count;
ACCEL table[1];
};
/**********************************************************************
* NtUserCopyAcceleratorTable (win32u.@)
*/
INT WINAPI NtUserCopyAcceleratorTable( HACCEL src, ACCEL *dst, INT count )
{
struct accelerator *accel;
int i;
if (!(accel = get_user_handle_ptr( src, NTUSER_OBJ_ACCEL ))) return 0;
if (accel == OBJ_OTHER_PROCESS)
{
FIXME_(accel)( "other process handle %p?\n", src );
return 0;
}
if (dst)
{
if (count > accel->count) count = accel->count;
for (i = 0; i < count; i++)
{
dst[i].fVirt = accel->table[i].fVirt & 0x7f;
dst[i].key = accel->table[i].key;
dst[i].cmd = accel->table[i].cmd;
}
}
else count = accel->count;
release_user_handle_ptr( accel );
return count;
}
/*********************************************************************
* NtUserCreateAcceleratorTable (win32u.@)
*/
HACCEL WINAPI NtUserCreateAcceleratorTable( ACCEL *table, INT count )
{
struct accelerator *accel;
HACCEL handle;
if (count < 1)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
accel = malloc( FIELD_OFFSET( struct accelerator, table[count] ));
if (!accel) return 0;
accel->count = count;
memcpy( accel->table, table, count * sizeof(*table) );
if (!(handle = alloc_user_handle( &accel->obj, NTUSER_OBJ_ACCEL ))) free( accel );
TRACE_(accel)("returning %p\n", handle );
return handle;
}
/******************************************************************************
* NtUserDestroyAcceleratorTable (win32u.@)
*/
BOOL WINAPI NtUserDestroyAcceleratorTable( HACCEL handle )
{
struct accelerator *accel;
if (!(accel = free_user_handle( handle, NTUSER_OBJ_ACCEL ))) return FALSE;
if (accel == OBJ_OTHER_PROCESS)
{
FIXME_(accel)( "other process handle %p\n", accel );
return FALSE;
}
free( accel );
return TRUE;
}
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
#include <stdlib.h>
#include "win32u_private.h" #include "win32u_private.h"
/* extra stock object: default 1x1 bitmap for memory DCs */ /* extra stock object: default 1x1 bitmap for memory DCs */
......
...@@ -106,8 +106,11 @@ static void * const syscalls[] = ...@@ -106,8 +106,11 @@ static void * const syscalls[] =
NtUserBuildHwndList, NtUserBuildHwndList,
NtUserCloseDesktop, NtUserCloseDesktop,
NtUserCloseWindowStation, NtUserCloseWindowStation,
NtUserCopyAcceleratorTable,
NtUserCreateAcceleratorTable,
NtUserCreateDesktopEx, NtUserCreateDesktopEx,
NtUserCreateWindowStation, NtUserCreateWindowStation,
NtUserDestroyAcceleratorTable,
NtUserFindExistingCursorIcon, NtUserFindExistingCursorIcon,
NtUserGetClipboardFormatName, NtUserGetClipboardFormatName,
NtUserGetClipboardOwner, NtUserGetClipboardOwner,
......
...@@ -802,9 +802,9 @@ ...@@ -802,9 +802,9 @@
@ stub NtUserConfirmResizeCommit @ stub NtUserConfirmResizeCommit
@ stub NtUserConsoleControl @ stub NtUserConsoleControl
@ stub NtUserConvertMemHandle @ stub NtUserConvertMemHandle
@ stub NtUserCopyAcceleratorTable @ stdcall -syscall NtUserCopyAcceleratorTable(long ptr long)
@ stdcall NtUserCountClipboardFormats() @ stdcall NtUserCountClipboardFormats()
@ stub NtUserCreateAcceleratorTable @ stdcall -syscall NtUserCreateAcceleratorTable(ptr long)
@ stub NtUserCreateActivationGroup @ stub NtUserCreateActivationGroup
@ stub NtUserCreateActivationObject @ stub NtUserCreateActivationObject
@ stub NtUserCreateCaret @ stub NtUserCreateCaret
...@@ -826,7 +826,7 @@ ...@@ -826,7 +826,7 @@
@ stub NtUserDelegateInput @ stub NtUserDelegateInput
@ stub NtUserDeleteMenu @ stub NtUserDeleteMenu
@ stub NtUserDeleteWindowGroup @ stub NtUserDeleteWindowGroup
@ stub NtUserDestroyAcceleratorTable @ stdcall -syscall NtUserDestroyAcceleratorTable(long)
@ stub NtUserDestroyActivationGroup @ stub NtUserDestroyActivationGroup
@ stub NtUserDestroyActivationObject @ stub NtUserDestroyActivationObject
@ stdcall NtUserDestroyCursor(long long) @ stdcall NtUserDestroyCursor(long long)
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define __WINE_WIN32U_PRIVATE #define __WINE_WIN32U_PRIVATE
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "ntgdi.h" #include "ntgdi.h"
......
...@@ -93,8 +93,11 @@ ...@@ -93,8 +93,11 @@
SYSCALL_ENTRY( NtUserBuildHwndList ) \ SYSCALL_ENTRY( NtUserBuildHwndList ) \
SYSCALL_ENTRY( NtUserCloseDesktop ) \ SYSCALL_ENTRY( NtUserCloseDesktop ) \
SYSCALL_ENTRY( NtUserCloseWindowStation ) \ SYSCALL_ENTRY( NtUserCloseWindowStation ) \
SYSCALL_ENTRY( NtUserCopyAcceleratorTable ) \
SYSCALL_ENTRY( NtUserCreateAcceleratorTable ) \
SYSCALL_ENTRY( NtUserCreateDesktopEx ) \ SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
SYSCALL_ENTRY( NtUserCreateWindowStation ) \ SYSCALL_ENTRY( NtUserCreateWindowStation ) \
SYSCALL_ENTRY( NtUserDestroyAcceleratorTable ) \
SYSCALL_ENTRY( NtUserFindExistingCursorIcon ) \ SYSCALL_ENTRY( NtUserFindExistingCursorIcon ) \
SYSCALL_ENTRY( NtUserGetClipboardFormatName ) \ SYSCALL_ENTRY( NtUserGetClipboardFormatName ) \
SYSCALL_ENTRY( NtUserGetClipboardOwner ) \ SYSCALL_ENTRY( NtUserGetClipboardOwner ) \
......
...@@ -491,3 +491,27 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args ) ...@@ -491,3 +491,27 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
info32->rcCaret = info.rcCaret; info32->rcCaret = info.rcCaret;
return TRUE; return TRUE;
} }
NTSTATUS WINAPI wow64_NtUserCopyAcceleratorTable( UINT *args )
{
HACCEL src = get_handle( &args );
ACCEL *dst = get_ptr( &args );
INT count = get_ulong( &args );
return NtUserCopyAcceleratorTable( src, dst, count );
}
NTSTATUS WINAPI wow64_NtUserCreateAcceleratorTable( UINT *args )
{
ACCEL *table = get_ptr( &args );
INT count = get_ulong( &args );
return HandleToUlong( NtUserCreateAcceleratorTable( table, count ));
}
NTSTATUS WINAPI wow64_NtUserDestroyAcceleratorTable( UINT *args )
{
HACCEL handle = get_handle( &args );
return NtUserDestroyAcceleratorTable( handle );
}
...@@ -215,12 +215,15 @@ LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *d ...@@ -215,12 +215,15 @@ LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *d
BOOL WINAPI NtUserClipCursor( const RECT *rect ); BOOL WINAPI NtUserClipCursor( const RECT *rect );
BOOL WINAPI NtUserCloseDesktop( HDESK handle ); BOOL WINAPI NtUserCloseDesktop( HDESK handle );
BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle ); BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle );
INT WINAPI NtUserCopyAcceleratorTable( HACCEL src, ACCEL *dst, INT count );
INT WINAPI NtUserCountClipboardFormats(void); INT WINAPI NtUserCountClipboardFormats(void);
HACCEL WINAPI NtUserCreateAcceleratorTable( ACCEL *table, INT count );
HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *device, HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *device,
DEVMODEW *devmode, DWORD flags, ACCESS_MASK access, DEVMODEW *devmode, DWORD flags, ACCESS_MASK access,
ULONG heap_size ); ULONG heap_size );
HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3, HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3,
ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 ); ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
BOOL WINAPI NtUserDestroyAcceleratorTable( HACCEL handle );
BOOL WINAPI NtUserDestroyCursor( HCURSOR cursor, ULONG arg ); BOOL WINAPI NtUserDestroyCursor( HCURSOR cursor, ULONG arg );
BOOL WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width, BOOL WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width,
INT height, UINT istep, HBRUSH hbr, UINT flags ); INT height, UINT istep, HBRUSH hbr, UINT flags );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment