There are three differently sized accelerator structures exposed to the user:
Accelerators in NE resources. This is also the internal layout of the global handle HACCEL (16 and 32) in Windows 95 and Wine. Exposed to the user as Win16 global handles HACCEL16 and HACCEL32 by the Win16/Win32 API. These are 5 bytes long, with no padding:
BYTE fVirt; WORD key; WORD cmd; |
Accelerators in PE resources. They are exposed to the user only by direct accessing PE resources. These have a size of 8 bytes:
BYTE fVirt; BYTE pad0; WORD key; WORD cmd; WORD pad1; |
Accelerators in the Win32 API. These are exposed to the
user by the CopyAcceleratorTable
and CreateAcceleratorTable
functions
in the Win32 API.
These have a size of 6 bytes:
BYTE fVirt; BYTE pad0; WORD key; WORD cmd; |
Why two types of accelerators in the Win32 API? We can only
guess, but my best bet is that the Win32 resource compiler
can/does not handle struct packing. Win32 ACCEL
is defined using #pragma(2)
for the
compiler but without any packing for RC, so it will assume
#pragma(4)
.