From a49bb2661d11b4a6e5226250f326dfaf7a23e91f Mon Sep 17 00:00:00 2001 From: Joshua Thielen Date: Sun, 4 Jul 1999 12:55:10 +0000 Subject: [PATCH] Fixed DestroyAcceleratorTable and implemented CreateAcceleratorTableW. --- include/winuser.h | 3 +++ loader/resource.c | 59 ++++++++++++++++++++++++++++++++++++++++++--- relay32/user32.spec | 2 +- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/include/winuser.h b/include/winuser.h index 0af79afd4b1..d6c70fa738f 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -2921,6 +2921,9 @@ WORD WINAPI CascadeWindows(HWND, UINT, const LPRECT, UINT, const HWND *); INT WINAPI CopyAcceleratorTableA(HACCEL,LPACCEL,INT); INT WINAPI CopyAcceleratorTableW(HACCEL,LPACCEL,INT); #define CopyAcceleratorTable WINELIB_NAME_AW(CopyAcceleratorTable) +HACCEL WINAPI CreateAcceleratorTableA(LPACCEL,INT); +HACCEL WINAPI CreateAcceleratorTableW(LPACCEL,INT); +#define CreateAcceleratorTable WINELIB_NAME_AW(CreateAcceleratorTable) HICON WINAPI CreateIconIndirect(LPICONINFO); BOOL WINAPI DestroyAcceleratorTable(HACCEL); BOOL WINAPI EnumDisplayMonitors(HDC,LPRECT,MONITORENUMPROC,LPARAM); diff --git a/loader/resource.c b/loader/resource.c index 38f412e1645..8b66bf654e6 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -31,6 +31,7 @@ #include "libres.h" #include "winerror.h" #include "debugstr.h" +#include "winnls.h" DECLARE_DEBUG_CHANNEL(accel) DECLARE_DEBUG_CHANNEL(resource) @@ -777,6 +778,60 @@ HACCEL WINAPI CreateAcceleratorTableA(LPACCEL lpaccel, INT cEntries) return hAccel; } +/********************************************************************* + * CreateAcceleratorTableW (USER32.64) + * + * + */ +HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccel, INT cEntries) +{ + HACCEL hAccel; + LPACCEL16 accel; + int i; + char ckey; + + /* Do parameter checking just in case someone's trying to be + funny. */ + if(cEntries < 1) { + WARN_(accel)("Application sent invalid parameters (%p %d).\n", + lpaccel, cEntries); + SetLastError(ERROR_INVALID_PARAMETER); + return (HACCEL)NULL; + } + FIXME_(accel)("should check that the accelerator descriptions are valid," + " return NULL and SetLastError() if not.\n"); + + + /* Allocate memory and copy the table. */ + hAccel = GlobalAlloc16(0,cEntries*sizeof(ACCEL16)); + + TRACE_(accel)("handle %x\n", hAccel); + if(!hAccel) { + ERR_(accel)("Out of memory.\n"); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return (HACCEL)NULL; + } + accel = GlobalLock16(hAccel); + + + for (i=0;i