Added proper handling TVIS_OVERLAYMASK flag and allows to display
overlay images. Fixed off by one error with listitem in
TREEVIEW_InsertItemA (uNumItems is 0 based, cChildren is a count).

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index dc15b35..e7f8c28 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -757,13 +757,18 @@
  
     if (himlp)         
     { 
-      ImageList_Draw ( *himlp, imageIndex, hdc, xpos-2, r.top+1, ILD_NORMAL);
-   	  ImageList_GetIconSize (*himlp, &cx, &cy);
-	  wineItem->bitmap.left=xpos-2;
-	  wineItem->bitmap.right=xpos-2+cx;
-	  wineItem->bitmap.top=r.top+1;
-	  wineItem->bitmap.bottom=r.top+1+cy;
-   	  xpos+=cx;
+	int ovlIdx = 0;
+
+	if(wineItem->stateMask & TVIS_OVERLAYMASK)
+        	ovlIdx = wineItem->state & TVIS_OVERLAYMASK;
+
+	ImageList_Draw ( *himlp, imageIndex, hdc, xpos-2, r.top+1, ILD_NORMAL|ovlIdx);
+	ImageList_GetIconSize (*himlp, &cx, &cy);
+	wineItem->bitmap.left=xpos-2;
+	wineItem->bitmap.right=xpos-2+cx;
+	wineItem->bitmap.top=r.top+1;
+	wineItem->bitmap.bottom=r.top+1+cy;
+	xpos+=cx;
     }
   }
 
@@ -1773,8 +1778,8 @@
   
   	wineItem->parent = ptdi->hParent;
   	sibItem          = &infoPtr->items [(INT)parentItem->firstChild];
-  	parentItem->cChildren++;
   	listItems        = parentItem->cChildren;
+  	parentItem->cChildren++;
   }
 
   
@@ -1814,7 +1819,7 @@
   wineItem->firstChild=0;
   wineItem->hItem=(HTREEITEM)iItem;
 
-  if (listItems>1) {
+  if (listItems!=0) {
      prevsib=NULL;
 
      switch ((DWORD) ptdi->hInsertAfter) {