mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
Fixed a bug in the accelerators code
svn path=/trunk/; revision=5176
This commit is contained in:
parent
e1c932cd9e
commit
93baf2c7ad
3 changed files with 45 additions and 28 deletions
38
reactos/include/user32/accel.h
Normal file
38
reactos/include/user32/accel.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/* $Id: accel.h,v 1.1 2003/07/20 03:45:31 hyperion Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __USER32_ACCEL_H_INCLUDED__
|
||||||
|
#define __USER32_ACCEL_H_INCLUDED__
|
||||||
|
|
||||||
|
/* RT_ACCELERATOR resources are arrays of RES_ACCEL structures */
|
||||||
|
typedef struct _RES_ACCEL
|
||||||
|
{
|
||||||
|
WORD fVirt;
|
||||||
|
WORD key;
|
||||||
|
DWORD cmd;
|
||||||
|
}
|
||||||
|
RES_ACCEL;
|
||||||
|
|
||||||
|
/* ACCELERATOR TABLES CACHE */
|
||||||
|
/* Cache entry */
|
||||||
|
typedef struct _USER_ACCEL_CACHE_ENTRY
|
||||||
|
{
|
||||||
|
struct _USER_ACCEL_CACHE_ENTRY * Next;
|
||||||
|
ULONG_PTR Usage; /* how many times the table has been loaded */
|
||||||
|
HACCEL Object; /* handle to the NtUser accelerator table object */
|
||||||
|
HGLOBAL Data; /* base address of the resource data */
|
||||||
|
}
|
||||||
|
U32_ACCEL_CACHE_ENTRY;
|
||||||
|
|
||||||
|
/* Lock guarding the cache */
|
||||||
|
extern CRITICAL_SECTION U32AccelCacheLock;
|
||||||
|
|
||||||
|
/* Cache */
|
||||||
|
extern U32_ACCEL_CACHE_ENTRY * U32AccelCache;
|
||||||
|
|
||||||
|
extern U32_ACCEL_CACHE_ENTRY ** WINAPI U32AccelCacheFind(HANDLE, HGLOBAL);
|
||||||
|
extern void WINAPI U32AccelCacheAdd(HACCEL, HGLOBAL);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1,6 +1,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <user32/callback.h>
|
#include <user32/callback.h>
|
||||||
|
#include <user32/accel.h>
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
@ -44,6 +45,8 @@ Init(VOID)
|
||||||
|
|
||||||
UserSetupInternalPos();
|
UserSetupInternalPos();
|
||||||
|
|
||||||
|
RtlInitializeCriticalSection(&U32AccelCacheLock);
|
||||||
|
|
||||||
GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
|
GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: accel.c,v 1.9 2003/07/11 17:08:44 chorns Exp $
|
/* $Id: accel.c,v 1.10 2003/07/20 03:45:31 hyperion Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -28,42 +28,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
#include <string.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <user32.h>
|
#include <user32/accel.h>
|
||||||
#include <debug.h>
|
#include <win32k/ntuser.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
/* RT_ACCELERATOR resources are arrays of RES_ACCEL structures */
|
|
||||||
typedef struct _RES_ACCEL
|
|
||||||
{
|
|
||||||
WORD fVirt;
|
|
||||||
WORD key;
|
|
||||||
DWORD cmd;
|
|
||||||
}
|
|
||||||
RES_ACCEL;
|
|
||||||
|
|
||||||
/* ACCELERATOR TABLES CACHE */
|
|
||||||
/* Cache entry */
|
|
||||||
typedef struct _USER_ACCEL_CACHE_ENTRY
|
|
||||||
{
|
|
||||||
struct _USER_ACCEL_CACHE_ENTRY * Next;
|
|
||||||
ULONG_PTR Usage; /* how many times the table has been loaded */
|
|
||||||
HACCEL Object; /* handle to the NtUser accelerator table object */
|
|
||||||
HGLOBAL Data; /* base address of the resource data */
|
|
||||||
}
|
|
||||||
U32_ACCEL_CACHE_ENTRY;
|
|
||||||
|
|
||||||
/* Lock guarding the cache */
|
/* Lock guarding the cache */
|
||||||
CRITICAL_SECTION U32AccelCacheLock;
|
CRITICAL_SECTION U32AccelCacheLock;
|
||||||
|
|
||||||
/* Cache */
|
/* Cache */
|
||||||
U32_ACCEL_CACHE_ENTRY * U32AccelCache = NULL;
|
U32_ACCEL_CACHE_ENTRY * U32AccelCache = NULL;
|
||||||
|
|
||||||
U32_ACCEL_CACHE_ENTRY ** WINAPI U32AccelCacheFind(HANDLE, HGLOBAL);
|
|
||||||
void WINAPI U32AccelCacheAdd(HACCEL, HGLOBAL);
|
|
||||||
|
|
||||||
/* Look up a handle or resource address in the cache */
|
/* Look up a handle or resource address in the cache */
|
||||||
U32_ACCEL_CACHE_ENTRY ** WINAPI U32AccelCacheFind(HANDLE Object, HGLOBAL Data)
|
U32_ACCEL_CACHE_ENTRY ** WINAPI U32AccelCacheFind(HANDLE Object, HGLOBAL Data)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +196,7 @@ BOOL WINAPI DestroyAcceleratorTable(HACCEL hAccel)
|
||||||
U32_ACCEL_CACHE_ENTRY * pEntry = *ppEntry;
|
U32_ACCEL_CACHE_ENTRY * pEntry = *ppEntry;
|
||||||
|
|
||||||
/* decrement the reference count */
|
/* decrement the reference count */
|
||||||
nUsage = pEntry->Usage= pEntry->Usage - 1;
|
nUsage = pEntry->Usage = pEntry->Usage - 1;
|
||||||
|
|
||||||
/* reference count now zero: destroy the cache entry */
|
/* reference count now zero: destroy the cache entry */
|
||||||
if(nUsage == 0)
|
if(nUsage == 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue