Buggy code:
public final class OleFrame extends Composite { private COMObject iUnknown ; private COMObject iOleInPlaceFrame ; private IOleInPlaceActiveObject objIOleInPlaceActiveObject ; private OleClientSite currentdoc ; private int refCount = 0 ; private MenuItem [ ] fileMenuItems ; private MenuItem [ ] containerMenuItems ; private MenuItem [ ] windowMenuItems ; private Listener listener ; private static String CHECK_FOCUS = "OLE_CHECK_FOCUS" ; private static String HHOOK = "OLE_HHOOK" ; private static String HHOOKMSG = "OLE_HHOOK_MSG" ; private static boolean ignoreNextKey ; private static final short [ ] ACCENTS = new short [ ] { '~' , '`' , '\'' , '^' , '"' } ; private static final String CONSUME_KEY = "org.eclipse.swt.OleFrame.ConsumeKey" ; public OleFrame ( Composite parent , int style ) { } private static void initCheckFocus ( final Display display ) { } private static void initMsgHook ( Display display ) { } static int getMsgProc ( int code , int wParam , int lParam ) { Display display = Display . getCurrent ( ) ; if ( display == null ) return 0 ; LONG hHook = ( ( LONG ) ( display . getData ( OleFrame . HHOOK ) ) ) ; if ( hHook == null ) return 0 ; <START_BUG> if ( code < 0 ) { <END_BUG> return OS . CallNextHookEx ( hHook . value , ( ( int ) ( code ) ) , wParam , lParam ) ; } MSG msg = ( ( MSG ) ( display . getData ( OleFrame . HHOOKMSG ) ) ) ; OS . MoveMemory ( msg , lParam , sizeof ) ; int message = msg . message ; if ( ( ( OS . WM_KEYFIRST ) <= message ) && ( message <= ( OS . WM_KEYLAST ) ) ) { if ( display != null ) { Widget widget = null ; int hwnd = msg . hwnd ; while ( hwnd != 0 ) { widget = display . findWidget ( hwnd ) ; if ( widget != null ) break ; hwnd = OS . GetParent ( hwnd ) ; } if ( ( widget != null ) && ( widget instanceof OleClientSite ) ) { OleClientSite site = ( ( OleClientSite ) ( widget ) ) ; if ( ( site . handle ) == hwnd ) { boolean consumed = false ; int thread = OS . GetWindowThreadProcessId ( msg . hwnd , null ) ; GUITHREADINFO lpgui = new GUITHREADINFO ( ) ; lpgui . cbSize = GUITHREADINFO . sizeof ; boolean rc = OS . GetGUIThreadInfo ( thread , lpgui ) ; int mask = ( ( ( OS . GUI_INMENUMODE ) | ( OS . GUI_INMOVESIZE ) ) | ( OS . GUI_POPUPMENUMODE ) ) | ( OS . GUI_SYSTEMMENUMODE ) ; if ( ( ! rc ) || ( ( ( lpgui . flags ) & mask ) == 0 ) ) { OleFrame frame = site . frame ; frame . setData ( OleFrame . CONSUME_KEY , null ) ; consumed = frame . translateOleAccelerator ( msg ) ; if ( ( frame . getData ( OleFrame . CONSUME_KEY ) ) != null ) consumed = false ; frame . setData ( OleFrame . CONSUME_KEY , null ) ; } boolean accentKey = false ; switch ( msg . message ) { case OS . WM_KEYDOWN : case OS . WM_SYSKEYDOWN : { if ( ! ( OS . IsWinCE ) ) { switch ( ( ( int ) ( msg . wParam ) ) ) { case OS . VK_SHIFT : case OS . VK_MENU : case OS . VK_CONTROL : case OS . VK_CAPITAL : case OS . VK_NUMLOCK : case OS . VK_SCROLL : break ; default : { int mapKey = OS . MapVirtualKey ( ( ( int ) ( msg . wParam ) ) , 2 ) ; if ( mapKey != 0 ) { accentKey = ( mapKey & ( OS . IsWinNT ? - 2147483648 : 32768 ) ) != 0 ; if ( ! accentKey ) { for ( int i = 0 ; i < ( OleFrame . ACCENTS . length ) ; i ++ ) { int value = OS . VkKeyScan ( OleFrame . ACCENTS [ i ] ) ; if ( ( value != ( - 1 ) ) && ( ( value & 255 ) == ( msg . wParam ) ) ) { int state = value > > 8 ; if ( ( ( ( ( OS . GetKeyState ( VK_SHIFT ) ) < 0 ) == ( ( state & 1 ) != 0 ) ) && ( ( ( OS . GetKeyState ( VK_CONTROL ) ) < 0 ) == ( ( state & 2 ) != 0 ) ) ) && ( ( ( OS . GetKeyState ( VK_MENU ) ) < 0 ) == ( ( state & 4 ) != 0 ) ) ) { if ( ( state & 7 ) != 0 ) accentKey = true ; break ; } } } } } break ; } } } break ; } } if ( ( ( ! consumed ) && ( ! accentKey ) ) && ( ! ( OleFrame . ignoreNextKey ) ) ) { int hwndOld = msg . hwnd ; msg . hwnd = site . handle ; consumed = ( OS . DispatchMessage ( msg ) ) == 1 ; msg . hwnd = hwndOld ; } switch ( msg . message ) { case OS . WM_KEYDOWN : case OS . WM_SYSKEYDOWN : { switch ( ( ( int ) ( msg . wParam ) ) ) { case OS . VK_SHIFT : case OS . VK_MENU : case OS . VK_CONTROL : case OS . VK_CAPITAL : case OS . VK_NUMLOCK : case OS . VK_SCROLL : break ; default : { OleFrame . ignoreNextKey = accentKey ; break ; } } } }

Fix:
if ( ( code < 0 ) || ( ( wParam & ( OS . PM_REMOVE ) ) == 0 ) ) {