Buggy code:
OS . SendMessage ( handle , TVM_SETITEM , 0 , tvItem ) ; } if ( ( ( wParam & ( OS . MK_CONTROL ) ) != 0 ) && ( ! ( dragStarted ) ) ) { if ( hittestSelected ) { tvItem . state = 0 ; tvItem . hItem = lpht . hItem ; OS . SendMessage ( handle , TVM_SETITEM , 0 , tvItem ) ; } } } if ( redraw ) { RECT rect1 = new RECT ( ) ; RECT rect2 = new RECT ( ) ; rect1 . left = hOldItem ; rect2 . left = hNewItem ; int fItemRect = ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ? 0 : 1 ; if ( ( hooks ( EraseItem ) ) || ( hooks ( PaintItem ) ) ) fItemRect = 0 ; if ( ( ! ( OS . IsWinCE ) ) && ( ( OS . WIN32_VERSION ) >= ( OS . VERSION ( 6 , 0 ) ) ) ) fItemRect = 0 ; OS . SendMessage ( handle , TVM_GETITEMRECT , fItemRect , rect1 ) ; OS . SendMessage ( handle , TVM_GETITEMRECT , fItemRect , rect2 ) ; OS . DefWindowProc ( handle , WM_SETREDRAW , 1 , 0 ) ; OS . InvalidateRect ( handle , rect1 , true ) ; OS . InvalidateRect ( handle , rect2 , true ) ; OS . UpdateWindow ( handle ) ; } } if ( ( wParam & ( OS . MK_CONTROL ) ) == 0 ) { if ( ( ! hittestSelected ) || ( ! ( dragStarted ) ) ) { tvItem . state = 0 ; int oldProc = OS . GetWindowLong ( handle , GWL_WNDPROC ) ; OS . SetWindowLong ( handle , GWL_WNDPROC , Tree . TreeProc ) ; if ( ( ( style ) & ( SWT . VIRTUAL ) ) != 0 ) { int hItem = OS . SendMessage ( handle , TVM_GETNEXTITEM , TVGN_ROOT , 0 ) ; deselect ( hItem , tvItem , hNewItem ) ; } else { for ( int i = 0 ; i < ( items . length ) ; i ++ ) { TreeItem item = items [ i ] ; if ( ( item != null ) && ( ( item . handle ) != hNewItem ) ) { tvItem . hItem = item . handle ; OS . SendMessage ( handle , TVM_SETITEM , 0 , tvItem ) ; } } } tvItem . hItem = hNewItem ; tvItem . state = OS . TVIS_SELECTED ; OS . SendMessage ( handle , TVM_SETITEM , 0 , tvItem ) ; OS . SetWindowLong ( handle , GWL_WNDPROC , oldProc ) ; if ( ( wParam & ( OS . MK_SHIFT ) ) != 0 ) { RECT rect1 = new RECT ( ) ; if ( ( hAnchor ) == 0 ) hAnchor = hNewItem ; rect1 . left = hAnchor ; if ( ( OS . SendMessage ( handle , TVM_GETITEMRECT , 0 , rect1 ) ) != 0 ) { RECT rect2 = new RECT ( ) ; rect2 . left = hNewItem ; OS . SendMessage ( handle , TVM_GETITEMRECT , 0 , rect2 ) ; int flags = ( ( rect1 . top ) < ( rect2 . top ) ) ? OS . TVGN_NEXTVISIBLE : OS . TVGN_PREVIOUSVISIBLE ; tvItem . state = OS . TVIS_SELECTED ; int hItem = tvItem . hItem = hAnchor ; OS . SendMessage ( handle , TVM_SETITEM , 0 , tvItem ) ; while ( hItem != hNewItem ) { tvItem . hItem = hItem ; OS . SendMessage ( handle , TVM_SETITEM , 0 , tvItem ) ; hItem = OS . SendMessage ( handle , TVM_GETNEXTITEM , flags , hItem ) ; } } } } } } if ( ( wParam & ( OS . MK_SHIFT ) ) == 0 ) hAnchor = hNewItem ; if ( ! ( gestureCompleted ) ) { tvItem . hItem = hNewItem ; tvItem . mask = ( OS . TVIF_HANDLE ) | ( OS . TVIF_PARAM ) ; OS . SendMessage ( handle , TVM_GETITEM , 0 , tvItem ) ; Event event = new Event ( ) ; event . item = _getItem ( tvItem . hItem , tvItem . lParam ) ; postEvent ( Selection , event ) ; } gestureCompleted = false ; if ( dragStarted ) { <START_BUG> sendDragEvent ( ( ( short ) ( lParam & 65535 ) ) , ( ( short ) ( lParam > > 16 ) ) ) ; <END_BUG> } else { int bits = OS . GetWindowLong ( handle , GWL_STYLE ) ; if ( ( bits & ( OS . TVS_DISABLEDRAGDROP ) ) == 0 ) { sendMouseEvent ( MouseUp , 1 , handle , WM_LBUTTONUP , wParam , lParam ) ; } } dragStarted = false ; return new LRESULT ( code ) ; } LRESULT WM_MOUSEMOVE ( int wParam , int lParam ) { } LRESULT WM_MOVE ( int wParam , int lParam ) { } LRESULT WM_RBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_PAINT ( int wParam , int lParam ) { } LRESULT WM_PRINTCLIENT ( int wParam , int lParam ) { } LRESULT WM_SETFOCUS ( int wParam , int lParam ) { } LRESULT WM_SETFONT ( int wParam , int lParam ) { } LRESULT WM_SETREDRAW ( int wParam , int lParam ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT WM_SYSCOLORCHANGE ( int wParam , int lParam ) { } LRESULT wmColorChild ( int wParam , int lParam ) { } LRESULT wmNotify ( NMHDR hdr , int wParam , int lParam ) { } LRESULT wmNotifyChild ( NMHDR hdr , int wParam , int lParam ) { } }

Fix:
sendDragEvent ( 1 , ( ( short ) ( lParam & 65535 ) ) , ( ( short ) ( lParam > > 16 ) ) ) ;