Buggy code:
; public Tree ( Composite parent , int style ) { } static int checkStyle ( int style ) { } int _getBackgroundPixel ( ) { } void _setBackgroundPixel ( int pixel ) { } public void addSelectionListener ( SelectionListener listener ) { } public void addTreeListener ( TreeListener listener ) { } int borderHandle ( ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } boolean checkHandle ( int hwnd ) { } boolean checkScroll ( int hItem ) { } protected void checkSubclass ( ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void createItem ( TreeColumn column , int index ) { } void createItem ( TreeItem item , int hParent , int hInsertAfter ) { } void createParent ( ) { } void createWidget ( ) { } int defaultBackground ( ) { } void deregister ( ) { } public void deselectAll ( ) { } void destroyItem ( TreeColumn column ) { } void destroyItem ( TreeItem item ) { } void enableWidget ( boolean enabled ) { } int getBackgroundPixel ( ) { } int getForegroundPixel ( ) { } public int getGridLineWidth ( ) { } public int getHeaderHeight ( ) { } public boolean getHeaderVisible ( ) { } Point getImageSize ( ) { } public TreeColumn getColumn ( int index ) { } public int getColumnCount ( ) { } public TreeColumn [ ] getColumns ( ) { } public TreeItem getItem ( Point point ) { } public int getItemCount ( ) { } int getItemCount ( int hItem ) { } public int getItemHeight ( ) { } public TreeItem [ ] getItems ( ) { } TreeItem [ ] getItems ( int hTreeItem ) { } public boolean getLinesVisible ( ) { } public TreeItem getParentItem ( ) { } public TreeItem [ ] getSelection ( ) { } public int getSelectionCount ( ) { } public TreeItem getTopItem ( ) { } int imageIndex ( Image image ) { } int indexOf ( TreeColumn column ) { } void register ( ) { } boolean releaseItem ( TreeItem item , TVITEM tvItem ) { } void releaseItems ( TreeItem [ ] nodes , TVITEM tvItem ) { } void releaseHandle ( ) { } void releaseWidget ( ) { } public void removeAll ( ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void removeTreeListener ( TreeListener listener ) { } public void setInsertMark ( TreeItem item , boolean before ) { } public void setLinesVisible ( boolean show ) { } int scrolledHandle ( ) { } public void selectAll ( ) { } void setBackgroundPixel ( int pixel ) { } void setBounds ( int x , int y , int width , int height , int flags ) { } void setCursor ( ) { } void setCheckboxImageList ( ) { if ( ( ( style ) & ( SWT . CHECK ) ) == 0 ) return ; int count = 5 ; int height = OS . SendMessage ( handle , TVM_GETITEMHEIGHT , 0 , 0 ) ; int width = height ; <START_BUG> int flags = ImageList . CREATE_FLAGS ; <END_BUG> if ( ( ( style ) & ( SWT . RIGHT_TO_LEFT ) ) != 0 ) flags |= OS . ILC_MIRROR ; int hImageList = OS . ImageList_Create ( width , height , flags , count , count ) ; int hDC = OS . GetDC ( handle ) ; int memDC = OS . CreateCompatibleDC ( hDC ) ; int hBitmap = OS . CreateCompatibleBitmap ( hDC , ( width * count ) , height ) ; int hOldBitmap = OS . SelectObject ( memDC , hBitmap ) ; RECT rect = new RECT ( ) ; OS . SetRect ( rect , 0 , 0 , ( width * count ) , height ) ; int hBrush = OS . CreateSolidBrush ( _getBackgroundPixel ( ) ) ; OS . FillRect ( memDC , rect , hBrush ) ; OS . DeleteObject ( hBrush ) ; int oldFont = OS . SelectObject ( hDC , defaultFont ( ) ) ; TEXTMETRIC tm = ( OS . IsUnicode ) ? ( ( TEXTMETRIC ) ( new TEXTMETRICW ( ) ) ) : new TEXTMETRICA ( ) ; OS . GetTextMetrics ( hDC , tm ) ; OS . SelectObject ( hDC , oldFont ) ; int itemWidth = Math . min ( tm . tmHeight , width ) ; int itemHeight = Math . min ( tm . tmHeight , height ) ; int left = ( width - itemWidth ) // 2 ; int top = ( ( height - itemHeight ) // 2 ) + 1 ; OS . SetRect ( rect , ( left + width ) , top , ( ( left + width ) + itemWidth ) , ( top + itemHeight ) ) ; if ( ( ( OS . COMCTL32_MAJOR ) >= 6 ) && ( OS . IsAppThemed ( ) ) ) { int hTheme = OS . OpenThemeData ( handle , Tree . BUTTON ) ; OS . DrawThemeBackground ( hTheme , memDC , BP_CHECKBOX , CBS_UNCHECKEDNORMAL , rect , null ) ; rect . left += width ; rect . right += width ; OS . DrawThemeBackground ( hTheme , memDC , BP_CHECKBOX , CBS_CHECKEDNORMAL , rect , null ) ; rect . left += width ; rect . right += width ; OS . DrawThemeBackground ( hTheme , memDC , BP_CHECKBOX , CBS_UNCHECKEDNORMAL , rect , null ) ; rect . left += width ; rect . right += width ; OS . DrawThemeBackground ( hTheme , memDC , BP_CHECKBOX , CBS_MIXEDNORMAL , rect , null ) ; OS . CloseThemeData ( hTheme ) ; }

Fix:
int flags = ImageList . COLOR_FLAGS ;