Index: trunk/src/comdlg32/filedlg95.c
===================================================================
--- trunk/src/comdlg32/filedlg95.c	(revision 3200)
+++ trunk/src/comdlg32/filedlg95.c	(revision 3202)
@@ -11,5 +11,5 @@
 #include <misc.h>
 
-#define MapHModuleSL(a)	a
+#define MapHModuleSL(a) a
 #define MapHModuleLS(a) a
 
@@ -29,5 +29,4 @@
 #include "debugtools.h"
 #include "cderr.h"
-#include "tweak.h"
 #include "winnls.h"
 #include "shellapi.h"
@@ -43,8 +42,11 @@
 typedef struct SFolder
 {
-  int m_iImageIndex;    /* Index of picture in image list */
-  HIMAGELIST hImgList;
-  int m_iIndent;      /* Indentation index */
-  LPITEMIDLIST pidlItem;  /* absolute pidl of the item */ 
+  int          m_iImageIndex;    /* Index of picture in image list */
+  HIMAGELIST   hImgList;
+  int          m_iIndent;      /* Indentation index */
+  LPITEMIDLIST pidlItem;  /* absolute pidl of the item */
+  CHAR*        szDisplayName;
+  INT          iIcon;
+  HIMAGELIST   ilItemImage;
 
 } SFOLDER,*LPSFOLDER;
@@ -175,5 +177,5 @@
  *      GetFileName95
  *
- * Creates an Open common dialog box that lets the user select 
+ * Creates an Open common dialog box that lets the user select
  * the drive, directory, and the name of a file or set of files to open.
  *
@@ -212,5 +214,5 @@
     if( lRes == -1)
         return FALSE;
-    
+
     return lRes;
 }
@@ -230,6 +232,6 @@
   BOOL ret;
   FileOpenDlgInfos *fodInfos;
-  
-  /* Initialise FileOpenDlgInfos structure*/  
+
+  /* Initialise FileOpenDlgInfos structure*/
   fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
   memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn);
@@ -317,5 +319,5 @@
   fodInfos->DlgInfos.dwDlgProp = 0;
   fodInfos->DlgInfos.hwndCustomDlg = (HWND)NULL;
-  
+
   switch(iDlgType)
   {
@@ -353,5 +355,5 @@
       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter));
 
-  if (fodInfos->ofnInfos.lpstrFile) 
+  if (fodInfos->ofnInfos.lpstrFile)
   {
       /*
@@ -364,5 +366,5 @@
       MemFree((LPVOID)fodInfos->ofnInfos.lpstrFile);
   }
-  if (fodInfos->ofnInfos.lpstrFileTitle) 
+  if (fodInfos->ofnInfos.lpstrFileTitle)
     {
       if (ofn->lpstrFileTitle)
@@ -404,5 +406,5 @@
     /* filter is a list...  title\0ext\0......\0\0 */
     s = (LPWSTR)ofn->lpstrFilter;
-    
+
     while (*s)
       s = s+lstrlenW(s)+1;
@@ -470,5 +472,5 @@
 
   if (HIWORD(ofn->lpTemplateName))
-  { 
+  {
     fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1);
     lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);
@@ -481,5 +483,5 @@
   /* Initialise the dialog property */
   fodInfos->DlgInfos.dwDlgProp = 0;
-  
+
   switch(iDlgType)
   {
@@ -494,5 +496,5 @@
       ret = 0;
   }
-      
+
   /* Cleaning */
   ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset;
@@ -518,5 +520,5 @@
     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter));
 
-  if (fodInfos->ofnInfos.lpstrFile) 
+  if (fodInfos->ofnInfos.lpstrFile)
   {
       /*
@@ -544,132 +546,132 @@
 {
 
-	HWND hwndChild,hwndStc32;
-	RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp;
-	POINT ptMoveCtl;
-	POINT ptParentClient;
-
-	ptMoveCtl.x = ptMoveCtl.y = 0;
-	hwndStc32=GetDlgItem(hwndChildDlg,stc32);
-	GetClientRect(hwndParentDlg,&rectParent);
-	GetClientRect(hwndChildDlg,&rectChild);
-	if(hwndStc32)
-	{
-		GetWindowRect(hwndStc32,&rectStc32);
-		MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
-		CopyRect(&rectTemp,&rectStc32);
-
-		SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
-		SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
-
-		if(rectStc32.right < rectTemp.right)
-		{
-			ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
-			ptMoveCtl.x = 0;
-		}
-		else
-		{
-			ptMoveCtl.x = (rectStc32.right - rectTemp.right);
-			ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
-		}
-		if(rectStc32.bottom < rectTemp.bottom)
-		{
-			ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
-			ptMoveCtl.y = 0;
-		}
-		else
-		{
-			ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
-			ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
-		}
-	}
-	else
-	{
-		if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL)
+        HWND hwndChild,hwndStc32;
+        RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp;
+        POINT ptMoveCtl;
+        POINT ptParentClient;
+
+        ptMoveCtl.x = ptMoveCtl.y = 0;
+        hwndStc32=GetDlgItem(hwndChildDlg,stc32);
+        GetClientRect(hwndParentDlg,&rectParent);
+        GetClientRect(hwndChildDlg,&rectChild);
+        if(hwndStc32)
+        {
+                GetWindowRect(hwndStc32,&rectStc32);
+                MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
+                CopyRect(&rectTemp,&rectStc32);
+
+                SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
+                SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
+
+                if(rectStc32.right < rectTemp.right)
+                {
+                        ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
+                        ptMoveCtl.x = 0;
+                }
+                else
+                {
+                        ptMoveCtl.x = (rectStc32.right - rectTemp.right);
+                        ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
+                }
+                if(rectStc32.bottom < rectTemp.bottom)
+                {
+                        ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
+                        ptMoveCtl.y = 0;
+                }
+                else
+                {
+                        ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
+                        ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
+                }
+        }
+        else
+        {
+                if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL)
                    return;
-		ptParentClient.x = rectParent.right-rectParent.left;
-		ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
-		ptMoveCtl.y = rectParent.bottom-rectParent.top;
-		ptMoveCtl.x=0;
-	}
-	SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
-	AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
-
-	SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y,
-		 SWP_NOZORDER );
-	SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
-		(rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
-	
-	hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
-	if(hwndStc32)
-	{
-		GetWindowRect(hwndStc32,&rectStc32);
-		MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
-	}
-	else
-		SetRect(&rectStc32,0,0,0,0);
-
-	if (hwndChild )
-	{
-		do
-		{
-			if(hwndChild != hwndStc32)
-			{
-			if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
-				continue;
-			GetWindowRect(hwndChild,&rectCtrl);
-			MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
-                                  
-				/*
-				   Check the initial position of the controls relative to the initial
-				   position and size of stc32 (before it is expanded).
-				*/
+                ptParentClient.x = rectParent.right-rectParent.left;
+                ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
+                ptMoveCtl.y = rectParent.bottom-rectParent.top;
+                ptMoveCtl.x=0;
+        }
+        SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
+        AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
+
+        SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y,
+                 SWP_NOZORDER );
+        SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
+                (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
+
+        hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
+        if(hwndStc32)
+        {
+                GetWindowRect(hwndStc32,&rectStc32);
+                MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
+        }
+        else
+                SetRect(&rectStc32,0,0,0,0);
+
+        if (hwndChild )
+        {
+                do
+                {
+                        if(hwndChild != hwndStc32)
+                        {
+                        if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
+                                continue;
+                        GetWindowRect(hwndChild,&rectCtrl);
+                        MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
+
+                                /*
+                                   Check the initial position of the controls relative to the initial
+                                   position and size of stc32 (before it is expanded).
+                                */
                 if (rectCtrl.left > rectTemp.right && rectCtrl.top > rectTemp.bottom)
-				{
-					rectCtrl.left += ptMoveCtl.x;
-				rectCtrl.top  += ptMoveCtl.y;
-				}
-				else if (rectCtrl.left > rectTemp.right)
-					rectCtrl.left += ptMoveCtl.x;
-				else if (rectCtrl.top > rectTemp.bottom)
-					rectCtrl.top  += ptMoveCtl.y;
-					
-				SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top, 
-				rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
-				SWP_NOSIZE | SWP_NOZORDER );
-				}
-			}
-		while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
-	}		
-	hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
-	
-	if(hwndStc32)
-	{
-		GetWindowRect(hwndStc32,&rectStc32);
-		MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
-		ptMoveCtl.x = rectStc32.left - 0;
-		ptMoveCtl.y = rectStc32.top - 0;
-		if (hwndChild )
-		{
-			do
-			{
-				if(hwndChild != hwndChildDlg)
-				{
-
-					if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
-						continue;
-					GetWindowRect(hwndChild,&rectCtrl);
-					MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
-
-					rectCtrl.left += ptMoveCtl.x;
-					rectCtrl.top += ptMoveCtl.y;
-
-					SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top, 
-					rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
-					SWP_NOSIZE |SWP_NOZORDER );
-				}
-			}
-			while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
-		}		
-	}
+                                {
+                                        rectCtrl.left += ptMoveCtl.x;
+                                rectCtrl.top  += ptMoveCtl.y;
+                                }
+                                else if (rectCtrl.left > rectTemp.right)
+                                        rectCtrl.left += ptMoveCtl.x;
+                                else if (rectCtrl.top > rectTemp.bottom)
+                                        rectCtrl.top  += ptMoveCtl.y;
+
+                                SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
+                                rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
+                                SWP_NOSIZE | SWP_NOZORDER );
+                                }
+                        }
+                while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
+        }
+        hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
+
+        if(hwndStc32)
+        {
+                GetWindowRect(hwndStc32,&rectStc32);
+                MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
+                ptMoveCtl.x = rectStc32.left - 0;
+                ptMoveCtl.y = rectStc32.top - 0;
+                if (hwndChild )
+                {
+                        do
+                        {
+                                if(hwndChild != hwndChildDlg)
+                                {
+
+                                        if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
+                                                continue;
+                                        GetWindowRect(hwndChild,&rectCtrl);
+                                        MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
+
+                                        rectCtrl.left += ptMoveCtl.x;
+                                        rectCtrl.top += ptMoveCtl.y;
+
+                                        SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
+                                        rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
+                                        SWP_NOSIZE |SWP_NOZORDER );
+                                }
+                        }
+                        while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
+                }
+        }
 
 }
@@ -681,17 +683,17 @@
   switch(uMsg)
   {
-  	case WM_INITDIALOG:
-	{         
+        case WM_INITDIALOG:
+        {
             fodInfos = (FileOpenDlgInfos *)lParam;
                 lParam = (LPARAM) &fodInfos->ofnInfos;
-   		ArrangeCtrlPositions(hwnd,GetParent(hwnd));
+                ArrangeCtrlPositions(hwnd,GetParent(hwnd));
             if(fodInfos && (fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos.lpfnHook)
                  return CallWindowProcA((WNDPROC)fodInfos->ofnInfos.lpfnHook,hwnd,uMsg,wParam,lParam);
-	        return 0;	
-        } 
+                return 0;
+        }
     }
     if(fodInfos && (fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos.lpfnHook )
-        return CallWindowProcA((WNDPROC)fodInfos->ofnInfos.lpfnHook,hwnd,uMsg,wParam,lParam); 
-  return DefWindowProcA(hwnd,uMsg,wParam,lParam); 
+        return CallWindowProcA((WNDPROC)fodInfos->ofnInfos.lpfnHook,hwnd,uMsg,wParam,lParam);
+  return DefWindowProcA(hwnd,uMsg,wParam,lParam);
 }
 
@@ -704,55 +706,55 @@
    if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)
    {
-   	if (fodInfos->ofnInfos.Flags  & OFN_ENABLETEMPLATEHANDLE)
-   	{
+        if (fodInfos->ofnInfos.Flags  & OFN_ENABLETEMPLATEHANDLE)
+        {
            if( !(template = LockResource( fodInfos->ofnInfos.hInstance)))
-    		{
-        	COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
-        	return (HWND)NULL;
-    		}
-		
-   	}
- 	else
-   	{
-   	 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),
+                {
+                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
+                return (HWND)NULL;
+                }
+
+        }
+        else
+        {
+         if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),
             (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))
-    	{
-        	COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
-       		 return (HWND)NULL;
-    	}
-    	if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),
+        {
+                COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
+                 return (HWND)NULL;
+        }
+        if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),
              hRes )) ||
                  !(template = LockResource( hDlgTmpl )))
-    	{
-        	COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
-        	return (HWND)NULL;
-    	}
-  	}
-
-	hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
-   	if(hChildDlg)
-   	{
-   		ShowWindow(hChildDlg,SW_SHOW); 
-        	return hChildDlg;
-   	}
+        {
+                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
+                return (HWND)NULL;
+        }
+        }
+
+        hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
+        if(hChildDlg)
+        {
+                ShowWindow(hChildDlg,SW_SHOW);
+                return hChildDlg;
+        }
  }
  else if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook)
  {
-	RECT rectHwnd;
-	DLGTEMPLATE tmplate;
-	GetClientRect(hwnd,&rectHwnd);
-	tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
-	tmplate.dwExtendedStyle = 0;
-	tmplate.cdit = 0;
-	tmplate.x = 0;
-	tmplate.y = 0;
-	tmplate.cx = rectHwnd.right-rectHwnd.left;
-	tmplate.cy = rectHwnd.bottom-rectHwnd.top;
-       
-	return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
+        RECT rectHwnd;
+        DLGTEMPLATE tmplate;
+        GetClientRect(hwnd,&rectHwnd);
+        tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
+        tmplate.dwExtendedStyle = 0;
+        tmplate.cdit = 0;
+        tmplate.x = 0;
+        tmplate.y = 0;
+        tmplate.cx = rectHwnd.right-rectHwnd.left;
+        tmplate.cy = rectHwnd.bottom-rectHwnd.top;
+
+        return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
  }
 return (HWND)NULL;
 }
- 
+
 /***********************************************************************
 *          SendCustomDlgNotificationMessage
@@ -830,5 +832,5 @@
     return -1;
 }
- 
+
 /***********************************************************************
  *          FileOpenDlgProc95
@@ -841,11 +843,11 @@
   {
     case WM_INITDIALOG :
-         /* Adds the FileOpenDlgInfos in the property list of the dialog 
+         /* Adds the FileOpenDlgInfos in the property list of the dialog
             so it will be easily accessible through a GetPropA(...) */
-      	 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam);
-
-      	 FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
-      	 ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg = 
-     	CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
+         SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam);
+
+         FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
+         ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg =
+        CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
          SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
          return 0;
@@ -862,5 +864,5 @@
       }
       return FALSE;
-          
+
     case WM_GETISHELLBROWSER:
       return FILEDLG95_OnWMGetIShellBrowser(hwnd);
@@ -889,5 +891,5 @@
 
 #ifndef __WIN32OS2__
-  /* Make sure the common control DLL is loaded */      
+  /* Make sure the common control DLL is loaded */
   InitCommonControls();
 #endif
@@ -992,5 +994,5 @@
   /* Do not use the listview selection anymore */
   fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
-  return 0; 
+  return 0;
 }
 
@@ -1009,5 +1011,5 @@
   SetWindowLongA(hwnd,DWL_MSGRESULT,(LONG)fodInfos->Shell.FOIShellBrowser);
 
-  return TRUE; 
+  return TRUE;
 }
 
@@ -1029,5 +1031,5 @@
   TBADDBITMAP tba = { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR };
   RECT rectTB;
-  
+
   FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
 
@@ -1043,12 +1045,12 @@
   MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
 
-  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL, 
+  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL,
         WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
         0, 0, 150, 26,
-	hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL); 
- 
-  SetWindowPos(fodInfos->DlgInfos.hwndTB, 0, 
-  	rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
-	SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
+        hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL);
+
+  SetWindowPos(fodInfos->DlgInfos.hwndTB, 0,
+        rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
+        SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
 
   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
@@ -1059,5 +1061,5 @@
 
   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 6,(LPARAM) &tbb);
-  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0); 
+  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
 
   /* Set the window text with the text specified in the OPENFILENAME structure */
@@ -1098,5 +1100,5 @@
  *
  * Ok button WM_COMMAND message handler
- * 
+ *
  * If the function succeeds, the return value is nonzero.
  */
@@ -1132,17 +1134,17 @@
       char lpstrPathAndFile[MAX_PATH];
 
-      lpstrPathSpec[0]	  = '\0';
+      lpstrPathSpec[0]    = '\0';
       lpstrCurrentDir[0]  = '\0';
       lpstrPathAndFile[0] = '\0';
 
-      /* Separate the file spec from the path spec 
-	 e.g.: 
-	      lpstrSpecifiedByUser  lpstrPathSpec  lpstrFileSpec
-	      C:\TEXT1\TEXT2        C:\TEXT1          TEXT2
-      */      
+      /* Separate the file spec from the path spec
+         e.g.:
+              lpstrSpecifiedByUser  lpstrPathSpec  lpstrFileSpec
+              C:\TEXT1\TEXT2        C:\TEXT1          TEXT2
+      */
       lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser);
       strcpy(lpstrPathSpec,lpstrSpecifiedByUser);
       COMDLG32_PathRemoveFileSpecA(lpstrPathSpec);
-      
+
       /* Get the index of the selected item in the filetype combo box */
       fodInfos->ofnInfos.nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
@@ -1152,47 +1154,47 @@
       /* Get the current directory name */
       COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
-				    lpstrCurrentDir);
-
-      /* Create an absolute path name */ 
+                                    lpstrCurrentDir);
+
+      /* Create an absolute path name */
       if(lpstrSpecifiedByUser[1] != ':')
       {
           switch(lpstrSpecifiedByUser[0])
           {
-      	  /* Add drive spec  \TEXT => C:\TEXT */
-       	  case '\\':
-       	      {
+          /* Add drive spec  \TEXT => C:\TEXT */
+          case '\\':
+              {
               int lenPathSpec=strlen(lpstrPathSpec);
               INT iCopy = (lenPathSpec!=0?2:3);
               memmove(lpstrPathSpec+iCopy,lpstrPathSpec,lenPathSpec);
-       	      strncpy(lpstrPathSpec,lpstrCurrentDir,iCopy);
-       	      }
-       	      break;           
-          /* Go to parent ..\TEXT */ 
-	  case '.':
-	      {
-       		  INT iSize;
-       		  char lpstrTmp2[MAX_PATH];
-       		  LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\');
-
-       		  iSize = lpstrTmp - lpstrCurrentDir;
-       		  strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1);
-		  if(strlen(lpstrSpecifiedByUser) <= 3)
+              strncpy(lpstrPathSpec,lpstrCurrentDir,iCopy);
+              }
+              break;
+          /* Go to parent ..\TEXT */
+          case '.':
+              {
+                  INT iSize;
+                  char lpstrTmp2[MAX_PATH];
+                  LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\');
+
+                  iSize = lpstrTmp - lpstrCurrentDir;
+                  strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1);
+                  if(strlen(lpstrSpecifiedByUser) <= 3)
                   *lpstrFileSpec='\0';
-       		  if(strcmp(lpstrPathSpec,".."))
-       		      strcat(lpstrTmp2,&lpstrPathSpec[3]);
-		  strcpy(lpstrPathSpec,lpstrTmp2);
-       	      }
-       	      break;
-       	  default:
-  {
-       		  char lpstrTmp[MAX_PATH];
-
-       		  if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\"))
-       		      strcat(lpstrCurrentDir,"\\");
-       		  strcpy(lpstrTmp,lpstrCurrentDir);
-       		  strcat(lpstrTmp,lpstrPathSpec);
-       		  strcpy(lpstrPathSpec,lpstrTmp);
-       	      }
-                 
+                  if(strcmp(lpstrPathSpec,".."))
+                      strcat(lpstrTmp2,&lpstrPathSpec[3]);
+                  strcpy(lpstrPathSpec,lpstrTmp2);
+              }
+              break;
+          default:
+  {
+                  char lpstrTmp[MAX_PATH];
+
+                  if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\"))
+                      strcat(lpstrCurrentDir,"\\");
+                  strcpy(lpstrTmp,lpstrCurrentDir);
+                  strcat(lpstrTmp,lpstrPathSpec);
+                  strcpy(lpstrPathSpec,lpstrTmp);
+              }
+
           } /* end switch */
       }
@@ -1200,33 +1202,33 @@
       if(strlen(lpstrPathSpec))
       {
-	  /* Browse to the right directory */
-	  COMDLG32_SHGetDesktopFolder(&psfDesktop); 
-	  if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec)))
-	  {
-	      /* Browse to directory */
-	      IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
-					 browsePidl,
-					 SBSP_ABSOLUTE);
-	      COMDLG32_SHFree(browsePidl);
-	  }
-	  else
-	  {
-	      /* Path does not exist */
-	      if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
-	      {
-		  MessageBoxA(hwnd,
-			      "Path does not exist",
-			      fodInfos->ofnInfos.lpstrTitle,
-			      MB_OK | MB_ICONEXCLAMATION);
-		  return FALSE;
-	      }
-	  }
-	  
-	  strcat(lpstrPathAndFile,lpstrPathSpec);
-	  IShellFolder_Release(psfDesktop);
+          /* Browse to the right directory */
+          COMDLG32_SHGetDesktopFolder(&psfDesktop);
+          if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec)))
+          {
+              /* Browse to directory */
+              IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
+                                         browsePidl,
+                                         SBSP_ABSOLUTE);
+              COMDLG32_SHFree(browsePidl);
+          }
+          else
+          {
+              /* Path does not exist */
+              if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
+              {
+                  MessageBoxA(hwnd,
+                              "Path does not exist",
+                              fodInfos->ofnInfos.lpstrTitle,
+                              MB_OK | MB_ICONEXCLAMATION);
+                  return FALSE;
+              }
+          }
+
+          strcat(lpstrPathAndFile,lpstrPathSpec);
+          IShellFolder_Release(psfDesktop);
       }
       else
       {
-	  strcat(lpstrPathAndFile,lpstrCurrentDir);
+          strcat(lpstrPathAndFile,lpstrCurrentDir);
       }
 
@@ -1234,14 +1236,14 @@
       COMDLG32_PathAddBackslashA(lpstrPathAndFile);
       strcat(lpstrPathAndFile,lpstrFileSpec);
-      
+
       /* Update the edit field */
       SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec);
       SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1);
-      
+
       /* Don't go further if we dont have a file spec */
       if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec))
-	  return FALSE;
-
-      /* Time to check lpstrFileSpec         */ 
+          return FALSE;
+
+      /* Time to check lpstrFileSpec         */
       /* search => contains * or ?           */
       /* browse => contains a directory name */
@@ -1257,12 +1259,12 @@
          MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
 
-	  fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpstrFileSpec)+1)*2);
-	  lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,
-		      (LPSTR)strlwr((LPSTR)lpstrFileSpec));
-      
+          fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpstrFileSpec)+1)*2);
+          lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,
+                      (LPSTR)strlwr((LPSTR)lpstrFileSpec));
+
       IShellView_Refresh(fodInfos->Shell.FOIShellView);
 
-	  if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,
-						       lpstrFileSpec)))
+          if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,
+                                                       lpstrFileSpec)))
         CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,iPos);
 
@@ -1272,54 +1274,54 @@
       /* browse if the user specified a directory */
       browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
-	      lpstrFileSpec);
+              lpstrFileSpec);
       if (!browsePidl) /* not a directory check the specified file exists */
       {
-	  int iExt;
-	  char lpstrFileSpecTemp[MAX_PATH] = "";
-	  LPSTR lpstrExt;
-	  LPSTR lpOrg;
-	  LPSTR lpBuf;
-	  iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
-	  lpOrg = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, iExt);
-	  lpstrExt = lpOrg;
-
-	  /*
-	     add user specified extentions to the file one by one and
-	     check if the file exists
-	 */
-	  while(lpOrg)
-	 {
-	     int i;
-	     if ((lpstrExt = strchr(lpOrg, ';')))
-	     {
-		 i = lpstrExt - lpOrg;
-	     }
-	     else
-		 i = strlen(lpOrg);
-	     lpBuf = MemAlloc(i+1);
-	     strncpy(lpBuf, lpOrg, i);
-	     lpBuf[i] = 0;
-	     strcpy(lpstrFileSpecTemp, lpstrFileSpec);
-	     if (lpstrFileSpecTemp[strlen(lpstrFileSpecTemp)-1] == '.')
-	     {
-		 if (strchr(lpBuf, '.'))
-		     strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1);
-	     } else {
-		 if (strchr(lpBuf, '.'))
-		     strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
-	     }
-	     browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
-		     lpstrFileSpecTemp);
-	     MemFree((void *)lpBuf);
-	     if (browsePidl)
-	     {
-		 strcpy(lpstrFileSpec,lpstrFileSpecTemp);
-		 break;
-	     }
-	     if (lpstrExt)
-		 lpOrg = lpstrExt+1;
-	     else
-		 lpOrg = NULL;
-	 }
+          int iExt;
+          char lpstrFileSpecTemp[MAX_PATH] = "";
+          LPSTR lpstrExt;
+          LPSTR lpOrg;
+          LPSTR lpBuf;
+          iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
+          lpOrg = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, iExt);
+          lpstrExt = lpOrg;
+
+          /*
+             add user specified extentions to the file one by one and
+             check if the file exists
+         */
+          while(lpOrg)
+         {
+             int i;
+             if ((lpstrExt = strchr(lpOrg, ';')))
+             {
+                 i = lpstrExt - lpOrg;
+             }
+             else
+                 i = strlen(lpOrg);
+             lpBuf = MemAlloc(i+1);
+             strncpy(lpBuf, lpOrg, i);
+             lpBuf[i] = 0;
+             strcpy(lpstrFileSpecTemp, lpstrFileSpec);
+             if (lpstrFileSpecTemp[strlen(lpstrFileSpecTemp)-1] == '.')
+             {
+                 if (strchr(lpBuf, '.'))
+                     strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1);
+             } else {
+                 if (strchr(lpBuf, '.'))
+                     strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
+             }
+             browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
+                     lpstrFileSpecTemp);
+             MemFree((void *)lpBuf);
+             if (browsePidl)
+             {
+                 strcpy(lpstrFileSpec,lpstrFileSpecTemp);
+                 break;
+             }
+             if (lpstrExt)
+                 lpOrg = lpstrExt+1;
+             else
+                 lpOrg = NULL;
+         }
       }
 
@@ -1327,57 +1329,57 @@
       {
           ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
-	  int    nMsgBoxRet;
-	  char   lpstrFileExist[MAX_PATH + 50];
-
-          IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 
-				       1, 
-				       &browsePidl, 
-				       &ulAttr);
-
-	  /* Browse to directory if it is a folder */
-	  if (ulAttr & SFGAO_FOLDER)
-	  {
-	      if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
-						   browsePidl,
-						   SBSP_RELATIVE)))
+          int    nMsgBoxRet;
+          char   lpstrFileExist[MAX_PATH + 50];
+
+          IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder,
+                                       1,
+                                       &browsePidl,
+                                       &ulAttr);
+
+          /* Browse to directory if it is a folder */
+          if (ulAttr & SFGAO_FOLDER)
+          {
+              if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
+                                                   browsePidl,
+                                                   SBSP_RELATIVE)))
         {
-		  if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
+                  if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
         {
-		      MessageBoxA(hwnd,
-				  "Path does not exist",
-				  fodInfos->ofnInfos.lpstrTitle,
-				  MB_OK | MB_ICONEXCLAMATION);
-		      COMDLG32_SHFree(browsePidl);
-		      return FALSE;
+                      MessageBoxA(hwnd,
+                                  "Path does not exist",
+                                  fodInfos->ofnInfos.lpstrTitle,
+                                  MB_OK | MB_ICONEXCLAMATION);
+                      COMDLG32_SHFree(browsePidl);
+                      return FALSE;
         }
     }
-	      COMDLG32_SHFree(browsePidl);
-	      return FALSE;
+              COMDLG32_SHFree(browsePidl);
+              return FALSE;
     }
 
-	  /* The file does exist, so ask the user if we should overwrite it */
-	  if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && 
-	     (fodInfos->ofnInfos.Flags & OFN_OVERWRITEPROMPT))
-	  {
-		strcpy(lpstrFileExist, lpstrFileSpec);
-		strcat(lpstrFileExist, " already exists.\nDo you want to replace it?");
-
-		nMsgBoxRet = MessageBoxA(hwnd,
-			    		lpstrFileExist,
-			    		fodInfos->ofnInfos.lpstrTitle,
-			    		MB_YESNO | MB_ICONEXCLAMATION);
-		if (nMsgBoxRet == IDNO)
-		{
-		    COMDLG32_SHFree(browsePidl);
-		    return FALSE;
-		}
-	  }
-	  COMDLG32_SHFree(browsePidl);
+          /* The file does exist, so ask the user if we should overwrite it */
+          if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) &&
+             (fodInfos->ofnInfos.Flags & OFN_OVERWRITEPROMPT))
+          {
+                strcpy(lpstrFileExist, lpstrFileSpec);
+                strcat(lpstrFileExist, " already exists.\nDo you want to replace it?");
+
+                nMsgBoxRet = MessageBoxA(hwnd,
+                                        lpstrFileExist,
+                                        fodInfos->ofnInfos.lpstrTitle,
+                                        MB_YESNO | MB_ICONEXCLAMATION);
+                if (nMsgBoxRet == IDNO)
+                {
+                    COMDLG32_SHFree(browsePidl);
+                    return FALSE;
+                }
+          }
+          COMDLG32_SHFree(browsePidl);
       }
       else
     {
-	  /* File does not exist in current directory */
-
-	  /* The selected file does not exist */
+          /* File does not exist in current directory */
+
+          /* The selected file does not exist */
       /* Tell the user the selected does not exist */
       if(fodInfos->ofnInfos.Flags & OFN_FILEMUSTEXIST)
@@ -1387,12 +1389,12 @@
         char tmp[400];
 
-	      LoadStringA(COMMDLG_hInstance32,
-			  IDS_FILENOTFOUND,
-			  lpstrNotFound,
-			  100);
-	      LoadStringA(COMMDLG_hInstance32,
-			  IDS_VERIFYFILE,
-			  lpstrMsg,
-			  100);
+              LoadStringA(COMMDLG_hInstance32,
+                          IDS_FILENOTFOUND,
+                          lpstrNotFound,
+                          100);
+              LoadStringA(COMMDLG_hInstance32,
+                          IDS_VERIFYFILE,
+                          lpstrMsg,
+                          100);
 
         strcpy(tmp,fodInfos->ofnInfos.lpstrFile);
@@ -1402,9 +1404,9 @@
         strcat(tmp,lpstrMsg);
 
-	      MessageBoxA(hwnd,
-			  tmp,
-			  fodInfos->ofnInfos.lpstrTitle,
-			  MB_OK | MB_ICONEXCLAMATION);
-	return FALSE;
+              MessageBoxA(hwnd,
+                          tmp,
+                          fodInfos->ofnInfos.lpstrTitle,
+                          MB_OK | MB_ICONEXCLAMATION);
+        return FALSE;
       }
       /* Ask the user if he wants to create the file*/
@@ -1415,6 +1417,6 @@
         LoadStringA(COMMDLG_hInstance32,IDS_CREATEFILE,tmp,100);
 
-	      if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,
-				      MB_YESNO | MB_ICONQUESTION))
+              if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,
+                                      MB_YESNO | MB_ICONQUESTION))
         {
             /* Create the file, clean and exit */
@@ -1422,5 +1424,5 @@
             return EndDialog(hwnd,TRUE);
         }
-	return FALSE;        
+        return FALSE;
       }
     }
@@ -1431,40 +1433,40 @@
       if(!strrchr(lpstrPathAndFile,'.'))
       {
-      	  /* if the file has no extension, append the selected
-       	     extension of the filetype combo box */
-       	  int iExt; 
-       	  LPSTR lpstrExt;
-       	  iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
-	  lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt);
-
-	  if((LPSTR)-1 != lpstrTemp)
-	  { 
-	      if((lpstrExt = strchr(lpstrTemp,';')))
-	      {
-      	          int i = lpstrExt - lpstrTemp;
-       	          lpstrExt = MemAlloc(i);
-       	          strncpy(lpstrExt,&lpstrTemp[1],i-1);
-      	      }
-       	      else
-       	      {
-       	          lpstrExt = MemAlloc(strlen(lpstrTemp));
-       	          strcpy(lpstrExt,&lpstrTemp[1]);
-       	      }
-		  
-	      if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)
-	      {
-       	          lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2);
-       	          strcat(lpstrExt,".");
-       	          strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);
-       	      }
-	      strcat(lpstrPathAndFile,lpstrExt);
-	  }
+          /* if the file has no extension, append the selected
+             extension of the filetype combo box */
+          int iExt;
+          LPSTR lpstrExt;
+          iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
+          lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt);
+
+          if((LPSTR)-1 != lpstrTemp)
+          {
+              if((lpstrExt = strchr(lpstrTemp,';')))
+              {
+                  int i = lpstrExt - lpstrTemp;
+                  lpstrExt = MemAlloc(i);
+                  strncpy(lpstrExt,&lpstrTemp[1],i-1);
+              }
+              else
+              {
+                  lpstrExt = MemAlloc(strlen(lpstrTemp));
+                  strcpy(lpstrExt,&lpstrTemp[1]);
+              }
+
+              if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)
+              {
+                  lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2);
+                  strcat(lpstrExt,".");
+                  strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);
+              }
+              strcat(lpstrPathAndFile,lpstrExt);
+          }
       }
       /* Check that size size of the file does not exceed buffer size */
       if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos.nMaxFile)
       {
-	  /* set error FNERR_BUFFERTOSMALL */
-	  FILEDLG95_Clean(hwnd);
-      	  return EndDialog(hwnd,FALSE);
+          /* set error FNERR_BUFFERTOSMALL */
+          FILEDLG95_Clean(hwnd);
+          return EndDialog(hwnd,FALSE);
       }
       strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile);
@@ -1472,14 +1474,14 @@
       /* Set the lpstrFileTitle of the OPENFILENAME structure */
       if(fodInfos->ofnInfos.lpstrFileTitle)
-      	  strncpy(fodInfos->ofnInfos.lpstrFileTitle,
-       		  lpstrFileSpec,
-       		  fodInfos->ofnInfos.nMaxFileTitle);
-
-      /* Check if the file is to be opened as read only */	      
+          strncpy(fodInfos->ofnInfos.lpstrFileTitle,
+                  lpstrFileSpec,
+                  fodInfos->ofnInfos.nMaxFileTitle);
+
+      /* Check if the file is to be opened as read only */
       if(BST_CHECKED == SendDlgItemMessageA(hwnd,
-					    IDC_OPENREADONLY,
-					    BM_GETSTATE,0,0))
-	  SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,
-			     FILE_ATTRIBUTE_READONLY);
+                                            IDC_OPENREADONLY,
+                                            BM_GETSTATE,0,0))
+          SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,
+                             FILE_ATTRIBUTE_READONLY);
 
       /*  nFileExtension and nFileOffset of OPENFILENAME structure */
@@ -1489,5 +1491,5 @@
       fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;
 
-    
+
     /* clean and exit */
     FILEDLG95_Clean(hwnd);
@@ -1510,5 +1512,5 @@
 
   /*
-   * Initialisation of the FileOpenDialogInfos structure 
+   * Initialisation of the FileOpenDialogInfos structure
    */
 
@@ -1530,6 +1532,6 @@
 
   /* Construct the IShellBrowser interface */
-  fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);  
-    
+  fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);
+
   return NOERROR;
 }
@@ -1550,7 +1552,7 @@
 
   if(SUCCEEDED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView,
-					SVGIO_BACKGROUND,
-					&IID_IContextMenu,
-					(LPVOID*)&pcm)))
+                                        SVGIO_BACKGROUND,
+                                        &IID_IContextMenu,
+                                        (LPVOID*)&pcm)))
   {
     ci.cbSize = sizeof(CMINVOKECOMMANDINFO);
@@ -1589,5 +1591,5 @@
  *      FILEDLG95_SHELL_NewFolder
  *
- * Creates a new directory with New folder as name 
+ * Creates a new directory with New folder as name
  * If the function succeeds, the return value is nonzero.
  * FIXME: let the contextmenu (CMDSTR_NEWFOLDER) do this thing
@@ -1630,5 +1632,5 @@
   {
     bRes = CreateDirectoryA(lpstrNewDir,NULL);
-  
+
     if(bRes)
     {
@@ -1650,5 +1652,5 @@
       char lpstrTempText[128];
       char lpstrCaption[256];
-      
+
       /* Cannot Create folder because of permissions */
       LoadStringA(COMMDLG_hInstance32, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof(lpstrTempText));
@@ -1682,5 +1684,5 @@
  *      FILEDLG95_FILETYPE_Init
  *
- * Initialisation of the file type combo box 
+ * Initialisation of the file type combo box
  */
 static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
@@ -1699,5 +1701,5 @@
     for(;;)
     {
-      /* filter is a list...  title\0ext\0......\0\0 
+      /* filter is a list...  title\0ext\0......\0\0
        * Set the combo item text to the title and the item data
        *  to the ext
@@ -1719,9 +1721,9 @@
       if(!lpstrExt)
           break;
-      
+
       strcpy(lpstrExt,lpstrExtTmp);
 
       iStrIndex += strlen(lpstrExt) +1;
-            
+
       /* Add the item at the end of the combo */
       CBAddString(fodInfos->DlgInfos.hwndFileTypeCB,lpstrTmp);
@@ -1729,7 +1731,7 @@
     }
       /* Set the current filter to the one specified
-       * in the initialisation structure 
+       * in the initialisation structure
       */
-  
+
       /* set default filter index */
       if(fodInfos->ofnInfos.nFilterIndex == 0 && fodInfos->ofnInfos.lpstrCustomFilter == NULL)
@@ -1737,11 +1739,11 @@
       /* First, check to make sure our index isn't out of bounds. */
       if ( fodInfos->ofnInfos.nFilterIndex > iPos )
-  	fodInfos->ofnInfos.nFilterIndex = iPos;
- 
- 
+        fodInfos->ofnInfos.nFilterIndex = iPos;
+
+
       /* Get the current index selection. */
       CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,
                   fodInfos->ofnInfos.nFilterIndex-1);
-  
+
       /* Get the corresponding text string from the combo box. */
       lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
@@ -1772,5 +1774,5 @@
     {
       LPSTR lpstrFilter;
-
+//CB: todo: check if selection really changed
       /* Get the current item of the filetype combo box */
       int iItem = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
@@ -1844,15 +1846,15 @@
 
 }
-    
+
 /***********************************************************************
  *      FILEDLG95_LOOKIN_Init
  *
- * Initialisation of the look in combo box 
+ * Initialisation of the look in combo box
  */
 static HRESULT FILEDLG95_LOOKIN_Init(HWND hwndCombo)
 {
-  IShellFolder	*psfRoot, *psfDrives;
-  IEnumIDList	*lpeRoot, *lpeDrives;
-  LPITEMIDLIST	pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
+  IShellFolder  *psfRoot, *psfDrives;
+  IEnumIDList   *lpeRoot, *lpeDrives;
+  LPITEMIDLIST  pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
 
   LookInInfos *liInfos = MemAlloc(sizeof(LookInInfos));
@@ -1881,26 +1883,26 @@
       while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
       {
-	FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
-
-	/* special handling for CSIDL_DRIVES */
-	if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives))
-	{
-	  if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
-	  {
-	    /* enumerate the drives */
-	    if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
-	    {
-	      while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
-	      {
-	        pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1);
-	        FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
-	        COMDLG32_SHFree(pidlAbsTmp);
-	        COMDLG32_SHFree(pidlTmp1);
-	      }
-	      IEnumIDList_Release(lpeDrives);
-	    }
-	    IShellFolder_Release(psfDrives);
-	  }
-	}
+        FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
+
+        /* special handling for CSIDL_DRIVES */
+        if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives))
+        {
+          if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
+          {
+            /* enumerate the drives */
+            if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
+            {
+              while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
+              {
+                pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1);
+                FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
+                COMDLG32_SHFree(pidlAbsTmp);
+                COMDLG32_SHFree(pidlTmp1);
+              }
+              IEnumIDList_Release(lpeDrives);
+            }
+            IShellFolder_Release(psfDrives);
+          }
+        }
         COMDLG32_SHFree(pidlTmp);
       }
@@ -1927,9 +1929,6 @@
   RECT rectText;
   RECT rectIcon;
-  SHFILEINFOA sfi;
-  HIMAGELIST ilItemImage;
   int iIndentation;
   LPSFOLDER tmpFolder;
-
 
   LookInInfos *liInfos = (LookInInfos *)GetPropA(pDIStruct->hwndItem,LookInInfosStr);
@@ -1944,24 +1943,18 @@
     return 0;
 
-
-  if(pDIStruct->itemID == liInfos->uSelectedItem)
-  {
-    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
-                                               0,    
-                                               &sfi,    
-                                               sizeof (SHFILEINFOA),   
-                                               SHGFI_PIDL | SHGFI_SMALLICON |    
-                                               SHGFI_OPENICON | SHGFI_SYSICONINDEX    | 
-                                               SHGFI_DISPLAYNAME );   
-  }
-  else
-  {
-    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
-                                                  0, 
-                                                  &sfi, 
+  if (!tmpFolder->szDisplayName)
+  {
+    SHFILEINFOA sfi;
+    INT len;
+
+    tmpFolder->ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR)tmpFolder->pidlItem,
+                                                  0,
+                                                  &sfi,
                                                   sizeof (SHFILEINFOA),
-                                                  SHGFI_PIDL | SHGFI_SMALLICON | 
-                                                  SHGFI_SYSICONINDEX | 
-                                                  SHGFI_DISPLAYNAME);
+                                                  SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME);
+    len = strlen(sfi.szDisplayName)+1;
+    tmpFolder->szDisplayName = MemAlloc(len);
+    strcpy(tmpFolder->szDisplayName,sfi.szDisplayName);
+    tmpFolder->iIcon = sfi.iIcon;
   }
 
@@ -1981,19 +1974,9 @@
 
   /* Do not indent item  if drawing in the edit of the combo*/
-  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
-  {
+  if (pDIStruct->itemState & ODS_COMBOBOXEDIT)
     iIndentation = 0;
-    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
-                                                0, 
-                                                &sfi, 
-                                                sizeof (SHFILEINFOA), 
-                                                SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON 
-                                                | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME  );
-
-  }
   else
-  {
     iIndentation = tmpFolder->m_iIndent;
-  }
+
   /* Draw text and icon */
 
@@ -2010,16 +1993,16 @@
   rectText.bottom = pDIStruct->rcItem.bottom;
 
- 
+
   /* Draw the icon from the image list */
-  COMDLG32_ImageList_Draw(ilItemImage,
-                 sfi.iIcon,
-                 pDIStruct->hDC,  
-                 rectIcon.left,  
-                 rectIcon.top,  
-                 ILD_TRANSPARENT );  
+  COMDLG32_ImageList_Draw(tmpFolder->ilItemImage,
+                 tmpFolder->iIcon,
+                 pDIStruct->hDC,
+                 rectIcon.left,
+                 rectIcon.top,
+                 ILD_TRANSPARENT );
 
   /* Draw the associated text */
-  if(sfi.szDisplayName)
-    TextOutA(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,strlen(sfi.szDisplayName));
+  if (tmpFolder->szDisplayName)
+    TextOutA(pDIStruct->hDC,rectText.left,rectText.top,tmpFolder->szDisplayName,strlen(tmpFolder->szDisplayName));
 
 
@@ -2044,5 +2027,5 @@
     {
       LPSFOLDER tmpFolder;
-      int iItem; 
+      int iItem;
 
       iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB);
@@ -2050,5 +2033,5 @@
       if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
                                                iItem)))
-	return FALSE;
+        return FALSE;
 
 
@@ -2061,5 +2044,5 @@
       break;
     }
-      
+
   }
   return FALSE;
@@ -2083,6 +2066,7 @@
   if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr)))
     return -1;
-    
+
   tmpFolder->m_iIndent = 0;
+  tmpFolder->szDisplayName = NULL;
 
   if(!pidl)
@@ -2100,25 +2084,24 @@
   if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
     liInfos->iMaxIndentation = tmpFolder->m_iIndent;
-  
+
   COMDLG32_SHGetFileInfoA((LPSTR)pidl,
                   0,
                   &sfi,
                   sizeof(sfi),
-                  SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX 
-                  | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES);
-
+                  SHGFI_ATTRIBUTES);
 
   if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
-    {
-        int iItemID;
+  {
+    int iItemID;
+
     /* Add the item at the end of the list */
     if(iInsertId < 0)
     {
-      iItemID = CBAddString(hwnd,sfi.szDisplayName);
+      iItemID = CBAddString(hwnd,NULL);
     }
     /* Insert the item at the iInsertId position*/
     else
     {
-      iItemID = CBInsertString(hwnd,sfi.szDisplayName,iInsertId);
+      iItemID = CBInsertString(hwnd,NULL,iInsertId);
     }
 
@@ -2134,9 +2117,9 @@
  *      FILEDLG95_LOOKIN_InsertItemAfterParent
  *
- * Insert an item below its parent 
+ * Insert an item below its parent
  */
 static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl)
 {
-  
+
   LPITEMIDLIST pidlParent = GetParentPidl(pidl);
   int iParentPos;
@@ -2193,5 +2176,5 @@
     }
   }
-  
+
   CBSetCurSel(hwnd,iItemPos);
   liInfos->uSelectedItem = iItemPos;
@@ -2220,5 +2203,8 @@
   {
     SFOLDER *tmpFolder;
+
     tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
+    if (tmpFolder->szDisplayName) MemFree(tmpFolder->szDisplayName);
+    MemFree(tmpFolder);
     CBDeleteString(hwnd,iItemPos);
     liInfos->iMaxIndentation--;
@@ -2273,6 +2259,9 @@
     for(iPos = iCount-1;iPos>=0;iPos--)
     {
-        MemFree((LPVOID)(CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos)));
-        CBDeleteString(fodInfos->DlgInfos.hwndLookInCB,iPos);
+      SFOLDER *tmpFolder = (LPSFOLDER)CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
+
+      if (tmpFolder->szDisplayName) MemFree(tmpFolder->szDisplayName);
+      MemFree(tmpFolder);
+      CBDeleteString(fodInfos->DlgInfos.hwndLookInCB,iPos);
     }
     /* LookInInfos structure */
@@ -2287,7 +2276,7 @@
  *      GetName
  *
- * Get the pidl's display name (relative to folder) and 
+ * Get the pidl's display name (relative to folder) and
  * put it in lpstrFileName.
- * 
+ *
  * Return NOERROR on success,
  * E_FAIL otherwise
@@ -2312,6 +2301,6 @@
   /* Get the display name of the pidl relative to the folder */
   if (SUCCEEDED(hRes = IShellFolder_GetDisplayNameOf(lpsf,
-                                                     pidl, 
-                                                     dwFlags, 
+                                                     pidl,
+                                                     dwFlags,
                                                      &str)))
   {
@@ -2324,5 +2313,5 @@
  *      GetShellFolderFromPidl
  *
- * pidlRel is the item pidl relative 
+ * pidlRel is the item pidl relative
  * Return the IShellFolder of the absolute pidl
  */
@@ -2340,5 +2329,5 @@
       if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
       {
-	IShellFolder_Release(psfParent);
+        IShellFolder_Release(psfParent);
         return psf;
       }
@@ -2363,5 +2352,5 @@
   pidlParent = COMDLG32_PIDL_ILClone(pidl);
   COMDLG32_PIDL_ILRemoveLastID(pidlParent);
-     
+
   return pidlParent;
 }
@@ -2370,5 +2359,5 @@
  *      GetPidlFromName
  *
- * returns the pidl of the file name relative to folder 
+ * returns the pidl of the file name relative to folder
  * NULL if an error occured
  */
@@ -2384,11 +2373,11 @@
   if(!lpcstrFileName)
     return NULL;
-    
+
   MultiByteToWideChar(CP_ACP,
-                      MB_PRECOMPOSED,   
-                      lpcstrFileName,  
-                      -1,  
-                      (LPWSTR)lpwstrDirName,  
-                      MAX_PATH);  
+                      MB_PRECOMPOSED,
+                      lpcstrFileName,
+                      -1,
+                      (LPWSTR)lpwstrDirName,
+                      MAX_PATH);
 
   IShellFolder_ParseDisplayName(psf,                                0,
@@ -2397,5 +2386,5 @@
                                              &ulEaten,
                                              &pidl,
-                                NULL);   
+                                NULL);
 
     return pidl;
