Changeset 4511 for trunk/src


Ignore:
Timestamp:
Oct 21, 2000, 8:42:42 PM (25 years ago)
Author:
sandervl
Message:

Merged with latest Wine version (Wine 20001002 level (10-21-2000))

Location:
trunk/src/comdlg32
Files:
6 added
1 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/cdlg.h

    r3572 r4511  
    1 /* $Id: cdlg.h,v 1.6 2000-05-19 19:27:19 sandervl Exp $ */
     1/* $Id: cdlg.h,v 1.7 2000-10-21 18:42:09 sandervl Exp $ */
    22/*
    33 *  Common Dialog Boxes interface (32 bit)
     
    2121extern HINSTANCE        COMDLG32_hInstance;
    2222
     23#ifdef __cplusplus
     24extern "C" {
     25#endif
     26
    2327void    COMDLG32_SetCommDlgExtendedError(DWORD err);
    2428LPVOID  COMDLG32_AllocMem(int size);
     29
     30#ifdef __cplusplus
     31}
     32#endif
    2533
    2634
     
    128136#define COMDLG32_SHGetFileInfoA         SHGetFileInfoA
    129137#define COMDLG32_SHFree                 SHFree
     138#define COMDLG32_SHAlloc                SHAlloc
     139#define COMDLG32_SHGetDataFromIDListA   SHGetDataFromIDListA
     140#define COMDLG32_SHGetFolderPathA       SHGetFolderPathA
    130141
    131142DWORD WINAPI PathRemoveFileSpecA(LPSTR fn);
     
    134145/* PATH */
    135146#define COMDLG32_PathIsRootA            PathIsRootA
    136 #define COMDLG32_PathFindFilenameA      PathFindFileNameA
     147#define COMDLG32_PathFindFileNameA      PathFindFileNameA
    137148#define COMDLG32_PathRemoveFileSpecA    PathRemoveFileSpecA
    138149#define COMDLG32_PathMatchSpecW         PathMatchSpecW
    139150#define COMDLG32_PathAddBackslashA      PathAddBackslashA
     151#define COMDLG32_PathCanonicalizeA      PathCanonicalizeA
     152#define COMDLG32_PathGetDriveNumberA    PathGetDriveNumberA
     153#define COMDLG32_PathIsRelativeA        PathIsRelativeA
     154#define COMDLG32_PathFindNextComponentA PathFindNextComponentA
     155#define COMDLG32_PathAddBackslashW      PathAddBackslashW
     156#define COMDLG32_PathFindExtensionA     PathFindExtensionA
     157#define COMDLG32_PathAddExtensionA      PathAddExtensionA
    140158
    141159#else
    142 extern HDPA     (* WINAPI COMDLG32_DPA_Create) (INT); 
    143 extern LPVOID   (* WINAPI COMDLG32_DPA_GetPtr) (const HDPA, INT);   
    144 extern LPVOID   (* WINAPI COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa);
    145 extern LPVOID   (* WINAPI COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i);
    146 extern INT      (* WINAPI COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID);
    147 extern BOOL     (* WINAPI COMDLG32_DPA_Destroy) (const HDPA);
    148 
    149160/* IMAGELIST */
    150 extern HICON    (* WINAPI COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT);
    151 extern HIMAGELIST (* WINAPI COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT);
    152 extern BOOL     (* WINAPI COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
    153 extern BOOL     (* WINAPI COMDLG32_ImageList_Destroy) (HIMAGELIST himl);
     161extern BOOL     (WINAPI* COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
    154162
    155163/* ITEMIDLIST */
    156164
    157 extern LPITEMIDLIST (* WINAPI COMDLG32_PIDL_ILClone) (LPCITEMIDLIST);
    158 extern LPITEMIDLIST (* WINAPI COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
    159 extern LPITEMIDLIST (* WINAPI COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST);
    160 extern BOOL (* WINAPI COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST);
    161 extern BOOL (* WINAPI COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
     165extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST);
     166extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
     167extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST);
     168extern BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST);
     169extern BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
    162170
    163171/* SHELL */
    164 extern BOOL (* WINAPI COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
    165 extern HRESULT (* WINAPI COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
    166 extern DWORD (* WINAPI COMDLG32_SHGetDesktopFolder)(IShellFolder **);
    167 extern DWORD    (* WINAPI COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT);
    168 extern DWORD (* WINAPI COMDLG32_SHFree)(LPVOID);
     172extern BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
     173extern HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
     174extern DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **);
     175extern DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT);
     176extern LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD);
     177extern DWORD (WINAPI *COMDLG32_SHFree)(LPVOID);
     178extern HRESULT (WINAPI *COMDLG32_SHGetDataFromIDListA)(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len);
     179extern BOOL (WINAPI *COMDLG32_SHGetFolderPathA)(HWND,int,HANDLE,DWORD,LPSTR);
     180
    169181
    170182/* PATH */
    171 extern BOOL (* WINAPI COMDLG32_PathIsRootA)(LPCSTR x);
    172 extern LPCSTR (* WINAPI COMDLG32_PathFindFilenameA)(LPCSTR path);
    173 extern DWORD (* WINAPI COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
    174 extern BOOL (* WINAPI COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
    175 extern LPSTR (* WINAPI COMDLG32_PathAddBackslashA)(LPSTR path);
     183extern BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x);
     184extern LPSTR (WINAPI *COMDLG32_PathFindFileNameA)(LPCSTR path);
     185extern DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
     186extern BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
     187extern LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path);
     188extern BOOL (WINAPI *COMDLG32_PathCanonicalizeA)(LPSTR pszBuf, LPCSTR pszPath);
     189extern int (WINAPI *COMDLG32_PathGetDriveNumberA)(LPCSTR lpszPath);
     190extern BOOL (WINAPI *COMDLG32_PathIsRelativeA) (LPCSTR lpszPath);
     191extern LPSTR (WINAPI *COMDLG32_PathFindNextComponentA)(LPCSTR pszPath);
     192extern LPWSTR (WINAPI *COMDLG32_PathAddBackslashW)(LPWSTR lpszPath);
     193extern LPSTR (WINAPI *COMDLG32_PathFindExtensionA)(LPCVOID lpszPath);
     194extern BOOL (WINAPI *COMDLG32_PathAddExtensionA)(LPSTR  pszPath,LPCSTR pszExtension);
    176195#endif
    177196
  • trunk/src/comdlg32/cdlg_Ca.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Color"
  • trunk/src/comdlg32/cdlg_Cs.orc

    r3031 r4511  
    106106
    107107
    108 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
     108CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
    109109STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    110110CAPTION "Barvy"
  • trunk/src/comdlg32/cdlg_Da.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Farve"
  • trunk/src/comdlg32/cdlg_De.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Farbe"
  • trunk/src/comdlg32/cdlg_En.orc

    r3243 r4511  
    1 /* $Id: cdlg_En.orc,v 1.2 2000-03-26 16:31:39 cbratschi Exp $ */
    21LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
    3 
    4 /* Corel WINE 20000324 level */
    52
    63OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
     
    111108    COMBOBOX        1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
    112109                    WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
    113     DEFPUSHBUTTON   "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
     110    DEFPUSHBUTTON   "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 
    114111    PUSHBUTTON      "Cancel",IDCANCEL,218,23,40,14,WS_GROUP | WS_TABSTOP
    115112    PUSHBUTTON      "&Apply", 1026,218,40,40,14,WS_GROUP | WS_TABSTOP
    116113    PUSHBUTTON      "&Help" , 1038,218,57,40,14,WS_GROUP | WS_TABSTOP
    117114    GROUPBOX        "Effects",1072,6,72,84,34,WS_GROUP
    118     CHECKBOX        "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
    119     CHECKBOX        "&Underline", 1041, 10,94,50,10, BS_AUTOCHECKBOX
     115    CHECKBOX        "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
     116    CHECKBOX        "&Underline", 1041, 10,94,50,10, BS_AUTOCHECKBOX
    120117    LTEXT           "&Color:", 1091 ,6,110,30,9
    121118    COMBOBOX        1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
    122                     CBS_AUTOHSCROLL |  WS_BORDER | WS_VSCROLL | WS_TABSTOP
     119                    CBS_AUTOHSCROLL |  WS_BORDER | WS_VSCROLL | WS_TABSTOP
    123120    GROUPBOX        "Sample",1073,98,72,160,49,WS_GROUP
    124121    CTEXT           "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
     
    126123
    127124
    128 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    129126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    130127CAPTION "Color"
     
    173170 CONTROL "&Down", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12
    174171
    175  DEFPUSHBUTTON "&Find Next", IDOK, 182,  5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
    176  PUSHBUTTON "Cancel", IDCANCEL  , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
    177  PUSHBUTTON "&Help", pshHelp    , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP
     172 DEFPUSHBUTTON "&Find Next", IDOK, 182,  5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 
     173 PUSHBUTTON "Cancel", IDCANCEL  , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
     174 PUSHBUTTON "&Help", pshHelp    , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP
    178175}
    179176
     
    191188 CHECKBOX "Match &Case", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP
    192189
    193  DEFPUSHBUTTON "&Find Next", IDOK, 174,  4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
    194  PUSHBUTTON "&Replace", psh1    , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
     190 DEFPUSHBUTTON "&Find Next", IDOK, 174,  4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 
     191 PUSHBUTTON "&Replace", psh1    , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
    195192 PUSHBUTTON "Replace &All", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
    196  PUSHBUTTON "Cancel", IDCANCEL  , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
    197  PUSHBUTTON "&Help", pshHelp    , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
     193 PUSHBUTTON "Cancel", IDCANCEL  , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
     194 PUSHBUTTON "&Help", pshHelp    , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
    198195}
    199196
     
    202199STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
    203200      DS_CONTEXTHELP | DS_3DLOOK
    204 CAPTION "Print32"
     201CAPTION "Print"
    205202FONT 8, "Helv"
    206203{
     
    242239STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
    243240      DS_CONTEXTHELP | DS_3DLOOK
    244 CAPTION "Print32 Setup"
     241CAPTION "Print Setup"
    245242FONT 8, "Helv"
    246243BEGIN
     
    267264    LTEXT           "&Source:",       stc3,  16,128,  36, 8
    268265    COMBOBOX                          cmb3,  52,126, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
    269 
     266   
    270267    GROUPBOX        "Orientation",    grp1, 180, 92, 100,56, WS_GROUP
    271268    ICON            "",               ico1, 195,112,  18,20, WS_GROUP
     
    275272
    276273
    277 NEWFILEOPENORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 280, 164
     274NEWFILEOPENORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 287, 165
    278275STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU
    279276CAPTION "Open"
    280277FONT 8, "helv"
    281278{
    282     LTEXT       "Look &in",IDC_LOOKINSTATIC,7,6,41,8, SS_NOTIFY
    283     COMBOBOX    IDC_LOOKIN,50,3,138,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
    284 
    285     LTEXT       "" , IDC_TOOLBARSTATIC, 188, 2, 82, 17, NOT WS_GROUP | NOT WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
    286     LISTBOX     IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
    287 
    288     LTEXT       "File &name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY
    289     EDITTEXT    IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL
    290 
    291     LTEXT       "Files of &type",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY
    292     COMBOBOX    IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
    293 
    294     CONTROL     "Open as &read-only",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10
    295 
    296     DEFPUSHBUTTON       "&Open",                 IDOK,222,110,50,14
    297     PUSHBUTTON          "Cancel",                IDCANCEL,222,128,50,14
    298     PUSHBUTTON          "&Help",                 pshHelp,222,145,50,14
    299 }
    300 
    301 STRINGTABLE DISCARDABLE
    302 {
     279    LTEXT       "Look &in",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY
     280    COMBOBOX    IDC_LOOKIN,49,3,132,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     281
     282    LTEXT       "" , IDC_TOOLBARSTATIC, 181, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE
     283    LISTBOX     IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE
     284   
     285    LTEXT       "File &name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY
     286    EDITTEXT    IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL
     287   
     288    LTEXT       "Files of &type",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY
     289    COMBOBOX    IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
     290
     291    CONTROL     "Open as &read-only",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10
     292
     293    DEFPUSHBUTTON       "&Open",                 IDOK,222,110,50,14
     294    PUSHBUTTON          "Cancel",                IDCANCEL,222,128,50,14
     295    PUSHBUTTON          "&Help",                 pshHelp,222,145,50,14
     296}
     297
     298STRINGTABLE DISCARDABLE
     299{
     300    IDS_ABOUTBOX            "&About FolderPicker Test"
     301    IDS_DOCUMENTFOLDERS     "Document Folders"
     302    IDS_PERSONAL            "My Documents"
     303    IDS_FAVORITES           "My Favorites"
     304    IDS_PATH                "System Path"
     305    IDS_DESKTOP             "Desktop"
     306    IDS_FONTS               "Fonts"
     307    IDS_MYCOMPUTER          "My Computer"
     308}
     309
     310STRINGTABLE DISCARDABLE
     311{
     312    IDS_SYSTEMFOLDERS       "System Folders"
     313    IDS_LOCALHARDRIVES      "Local Hard Drives"
     314    IDS_FILENOTFOUND        "File not found"
    303315    IDS_VERIFYFILE          "Please verify if the correct file name was given"
    304316    IDS_CREATEFILE          "File does not exist\nDo you want to create file"
    305     IDS_CREATEFOLDER_DENIED "Unable to create the folder \"%s\"\n\nAccess is denied."
    306     IDS_FILEOPEN_CAPTION    "Open"
    307     IDS_FILENOTFOUND        "File Not Found"
     317    IDL_OVERWRITEFILE       "File does already exist.\nDo you want to replace it?"
     318    IDS_INVALID_FILENAME_TITLE "Invalid character(s) in path"
     319    IDS_INVALID_FILENAME    "A filename cannot contain any of the following characters: \n                          / : < > |"
     320    IDS_PATHNOTEXISTING     "Path does not exist"
     321    IDS_FILENOTEXISTING     "File does not exist"
    308322}
    309323
     
    314328    IDS_LISTVIEW         "List"
    315329    IDS_REPORTVIEW       "Details"
    316 }
     330    IDS_TODESKTOP        "Browse to Desktop"
     331}
    317332
    318333STRINGTABLE DISCARDABLE
  • trunk/src/comdlg32/cdlg_Eo.orc

    r3031 r4511  
    106106
    107107
    108 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
     108CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
    109109STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    110110CAPTION "Koloro"
  • trunk/src/comdlg32/cdlg_Es.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Color"
  • trunk/src/comdlg32/cdlg_Fi.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Väri"
  • trunk/src/comdlg32/cdlg_Fr.orc

    r3031 r4511  
    121121}
    122122
    123 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     123CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    124124STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    125125CAPTION "Couleurs"
     
    143143 CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
    144144 CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
    145  CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
     145 CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
    146146 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
    147147 CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
  • trunk/src/comdlg32/cdlg_Hu.orc

    r3031 r4511  
    122122
    123123
    124 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     124CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    125125STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    126126CAPTION "Szín"
  • trunk/src/comdlg32/cdlg_It.orc

    r3031 r4511  
    121121}
    122122
    123 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     123CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    124124STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    125125CAPTION "Colore"
  • trunk/src/comdlg32/cdlg_Ko.orc

    r3031 r4511  
    106106
    107107
    108 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     108CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    109109STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    110110CAPTION "»ö"
  • trunk/src/comdlg32/cdlg_Nl.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Kleur"
  • trunk/src/comdlg32/cdlg_No.orc

    r3031 r4511  
    106106
    107107
    108 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
     108CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
    109109STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    110110CAPTION "Farge"
  • trunk/src/comdlg32/cdlg_Pl.orc

    r3031 r4511  
    158158END
    159159   
    160 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     160CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    161161STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    162162CAPTION "Color"
  • trunk/src/comdlg32/cdlg_Pt.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Cor"
  • trunk/src/comdlg32/cdlg_Ru.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Èçìåíåíèå ïàëèòðû"
  • trunk/src/comdlg32/cdlg_Sv.orc

    r3031 r4511  
    123123
    124124
    125 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     125CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    126126STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    127127CAPTION "Färg"
  • trunk/src/comdlg32/cdlg_Wa.orc

    r3031 r4511  
    128128
    129129
    130 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
     130CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    131131STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    132132CAPTION "Coleurs"
  • trunk/src/comdlg32/cdlg_xx.orc

    r4049 r4511  
    1 /* $Id: cdlg_xx.orc,v 1.3 2000-08-19 18:36:16 sandervl Exp $*/
    21/*
    32 * Language neutral resources for Common Dialogs
    4  *
    5  * Corel WINE 20000324 level
    63 */
    74
     
    118
    1291 VERSIONINFO
     10//ifdef __WIN32OS2__
    1311FILEVERSION     0x04, 0x00, 0x0565, 0x013F
    1412PRODUCTVERSION  0x04, 0x00, 0x0565, 0x013F
     13//endif
    1514FILEFLAGSMASK 0x3fL
    1615FILEFLAGS 0xaL
     
    4645PD32_COLLATE ICON DISCARDABLE LOADONCALL
    4746{
    48  '00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02'
    49  '00 00 26 00 00 00 4C 18 10 00 00 00 00 00 48 05'
    50  '00 00 0E 03 00 00 28 00 00 00 20 00 00 00 40 00'
    51  '00 00 01 00 04 00 00 00 00 00 80 02 00 00 00 00'
    52  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    53  '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
    54  '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
    55  '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
    56  '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'
    57  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    58  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    59  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    60  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    61  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    62  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    63  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    64  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    65  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    66  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    67  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    68  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    69  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    70  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    71  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    72  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    73  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    74  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    75  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    76  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    77  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    78  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    79  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    80  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    81  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    82  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    83  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    84  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    85  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    86  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    87  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    88  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF'
    89  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    90  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    91  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    92  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    93  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    94  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    95  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    96  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF 28 00'
     47 '00 00 01 00 01 00 4C 18 10 00 00 00 00 00 48 05'
     48 '00 00 16 00 00 00 28 00'
    9749 '00 00 4C 00 00 00 30 00 00 00 01 00 04 00 00 00'
    9850 '00 00 E0 04 00 00 00 00 00 00 00 00 00 00 00 00'
     
    185137
    186138/* BINRES pd32_nocollate.ico */
    187 PD32_NOCOLLATE ICON
    188 {
    189  '00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02'
    190  '00 00 26 00 00 00 4C 18 10 00 00 00 00 00 48 05'
    191  '00 00 0E 03 00 00 28 00 00 00 20 00 00 00 40 00'
    192  '00 00 01 00 04 00 00 00 00 00 80 02 00 00 00 00'
    193  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    194  '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
    195  '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
    196  '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
    197  '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'
    198  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    199  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    200  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    201  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    202  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    203  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    204  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    205  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    206  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    207  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    208  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    209  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    210  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    211  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    212  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    213  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    214  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    215  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    216  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    217  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    218  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    219  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    220  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    221  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    222  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    223  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    224  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    225  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    226  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    227  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    228  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
    229  '00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF'
    230  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    231  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    232  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    233  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    234  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    235  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    236  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
    237  'FF FF FF FF FF FF FF FF FF FF FF FF FF FF 28 00'
     139PD32_NOCOLLATE ICON
     140{
     141 '00 00 01 00 01 00 4C 18 10 00 00 00 00 00 48 05'
     142 '00 00 16 00 00 00 28 00'
    238143 '00 00 4C 00 00 00 30 00 00 00 01 00 04 00 00 00'
    239144 '00 00 E0 04 00 00 00 00 00 00 00 00 00 00 00 00'
     
    323228}
    324229
    325 /******************
    326  * Bitmap
    327  */
    328 
    329 IDB_TOOLBAR     BITMAP DISCARDABLE
    330 {'
    331 42 4d 36 08 00 00 00 00 00 00 36 04 00 00 28 00
    332 00 00 40 00 00 00 10 00 00 00 01 00 08 00 00 00
    333 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00
    334 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80
    335 00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80
    336 00 00 c0 c0 c0 00 c0 dc c0 00 f0 ca a6 00 04 04
    337 04 00 08 08 08 00 0c 0c 0c 00 11 11 11 00 16 16
    338 16 00 1c 1c 1c 00 22 22 22 00 29 29 29 00 55 55
    339 55 00 4d 4d 4d 00 42 42 42 00 39 39 39 00 80 7c
    340 ff 00 50 50 ff 00 93 00 d6 00 ff ec cc 00 c6 d6
    341 ef 00 d6 e7 e7 00 90 a9 ad 00 00 00 33 00 00 00
    342 66 00 00 00 99 00 00 00 cc 00 00 33 00 00 00 33
    343 33 00 00 33 66 00 00 33 99 00 00 33 cc 00 00 33
    344 ff 00 00 66 00 00 00 66 33 00 00 66 66 00 00 66
    345 99 00 00 66 cc 00 00 66 ff 00 00 99 00 00 00 99
    346 33 00 00 99 66 00 00 99 99 00 00 99 cc 00 00 99
    347 ff 00 00 cc 00 00 00 cc 33 00 00 cc 66 00 00 cc
    348 99 00 00 cc cc 00 00 cc ff 00 00 ff 66 00 00 ff
    349 99 00 00 ff cc 00 33 00 00 00 33 00 33 00 33 00
    350 66 00 33 00 99 00 33 00 cc 00 33 00 ff 00 33 33
    351 00 00 33 33 33 00 33 33 66 00 33 33 99 00 33 33
    352 cc 00 33 33 ff 00 33 66 00 00 33 66 33 00 33 66
    353 66 00 33 66 99 00 33 66 cc 00 33 66 ff 00 33 99
    354 00 00 33 99 33 00 33 99 66 00 33 99 99 00 33 99
    355 cc 00 33 99 ff 00 33 cc 00 00 33 cc 33 00 33 cc
    356 66 00 33 cc 99 00 33 cc cc 00 33 cc ff 00 33 ff
    357 33 00 33 ff 66 00 33 ff 99 00 33 ff cc 00 33 ff
    358 ff 00 66 00 00 00 66 00 33 00 66 00 66 00 66 00
    359 99 00 66 00 cc 00 66 00 ff 00 66 33 00 00 66 33
    360 33 00 66 33 66 00 66 33 99 00 66 33 cc 00 66 33
    361 ff 00 66 66 00 00 66 66 33 00 66 66 66 00 66 66
    362 99 00 66 66 cc 00 66 99 00 00 66 99 33 00 66 99
    363 66 00 66 99 99 00 66 99 cc 00 66 99 ff 00 66 cc
    364 00 00 66 cc 33 00 66 cc 99 00 66 cc cc 00 66 cc
    365 ff 00 66 ff 00 00 66 ff 33 00 66 ff 99 00 66 ff
    366 cc 00 cc 00 ff 00 ff 00 cc 00 99 99 00 00 99 33
    367 99 00 99 00 99 00 99 00 cc 00 99 00 00 00 99 33
    368 33 00 99 00 66 00 99 33 cc 00 99 00 ff 00 99 66
    369 00 00 99 66 33 00 99 33 66 00 99 66 99 00 99 66
    370 cc 00 99 33 ff 00 99 99 33 00 99 99 66 00 99 99
    371 99 00 99 99 cc 00 99 99 ff 00 99 cc 00 00 99 cc
    372 33 00 66 cc 66 00 99 cc 99 00 99 cc cc 00 99 cc
    373 ff 00 99 ff 00 00 99 ff 33 00 99 cc 66 00 99 ff
    374 99 00 99 ff cc 00 99 ff ff 00 cc 00 00 00 99 00
    375 33 00 cc 00 66 00 cc 00 99 00 cc 00 cc 00 99 33
    376 00 00 cc 33 33 00 cc 33 66 00 cc 33 99 00 cc 33
    377 cc 00 cc 33 ff 00 cc 66 00 00 cc 66 33 00 99 66
    378 66 00 cc 66 99 00 cc 66 cc 00 99 66 ff 00 cc 99
    379 00 00 cc 99 33 00 cc 99 66 00 cc 99 99 00 cc 99
    380 cc 00 cc 99 ff 00 cc cc 00 00 cc cc 33 00 cc cc
    381 66 00 cc cc 99 00 cc cc cc 00 cc cc ff 00 cc ff
    382 00 00 cc ff 33 00 99 ff 66 00 cc ff 99 00 cc ff
    383 cc 00 cc ff ff 00 cc 00 33 00 ff 00 66 00 ff 00
    384 99 00 cc 33 00 00 ff 33 33 00 ff 33 66 00 ff 33
    385 99 00 ff 33 cc 00 ff 33 ff 00 ff 66 00 00 ff 66
    386 33 00 cc 66 66 00 ff 66 99 00 ff 66 cc 00 cc 66
    387 ff 00 ff 99 00 00 ff 99 33 00 ff 99 66 00 ff 99
    388 99 00 ff 99 cc 00 ff 99 ff 00 ff cc 00 00 ff cc
    389 33 00 ff cc 66 00 ff cc 99 00 ff cc cc 00 ff cc
    390 ff 00 ff ff 33 00 cc ff 66 00 ff ff 99 00 ff ff
    391 cc 00 66 66 ff 00 66 ff 66 00 66 ff ff 00 ff 66
    392 66 00 ff 66 ff 00 ff ff 66 00 21 00 a5 00 5f 5f
    393 5f 00 77 77 77 00 86 86 86 00 96 96 96 00 cb cb
    394 cb 00 b2 b2 b2 00 d7 d7 d7 00 dd dd dd 00 e3 e3
    395 e3 00 ea ea ea 00 f1 f1 f1 00 f8 f8 f8 00 f0 fb
    396 ff 00 a4 a0 a0 00 80 80 80 00 00 00 ff 00 00 ff
    397 00 00 00 ff ff 00 ff 00 00 00 ff 00 ff 00 ff ff
    398 00 00 ff ff ff 00 fa fa fa fa fa fa fa fa fa fa
    399 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    400 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    401 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    402 fa fa fa fa fa fa fa fa 92 92 92 92 92 92 92 92
    403 92 92 92 92 92 fa fa fa 6d 6d 6d 6d 6d 6d 6d 6d
    404 6d 6d 6d 6d 6d fa fa fa 00 00 00 fa fa fa fa fa
    405 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa
    406 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 00
    407 00 00 00 00 92 fa fa 00 00 00 00 00 00 00 00 00
    408 00 00 00 00 6d fa fa fa ff ff 00 fa 00 00 00 00
    409 00 00 fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00
    410 00 fa 00 00 00 fa fa 00 ff dd dd dd dd d6 d6 d6
    411 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd d6 d6 d6
    412 d6 d6 d6 00 6d fa fa fa ff ff 00 fa 00 00 00 00
    413 00 00 fa fa fa fa fa ff 00 fa fa fa fa fa fa fa
    414 fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd d6
    415 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd d6
    416 d6 d6 d6 00 6d fa fa fa ff ff 00 fa fa fa fa fa
    417 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    418 fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd dd
    419 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd
    420 d6 d6 d6 00 6d fa fa fa fa fa fa fa fa fa fa fa
    421 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa
    422 fa fa fa fa fa fa fa 00 ff dd dd dd dd 1f 1f 1f
    423 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd
    424 d6 fb d6 00 6d fa fa fa 00 00 00 fa fa fa fa fa
    425 fa fa fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00
    426 00 fa 00 00 00 fa fa 00 ff dd dd dd dd dd dd dd
    427 1f d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd
    428 d6 fb d6 00 6d fa fa fa ff ff 00 fa 00 00 00 00
    429 00 00 fa fa fa fa fa ff 00 fa fa fa fa fa fa fa
    430 fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd dd
    431 dd 1f d6 00 92 fa fa 00 ff dd dd dd dd dd fb dd
    432 dd fb d6 92 fb fa fa fa ff ff 00 fa 00 00 00 00
    433 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    434 fa fa fa fa fa fa fa 00 ff ff ff ff ff ff ff ff
    435 ff 1f c3 00 fa fa fa 00 ff ff ff ff ff ff ff fb
    436 ff fb c3 fb fa fa fa fa ff ff 00 fa fa fa fa fa
    437 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa
    438 fa fa fa fa fa fa fa 00 d6 d6 d6 d6 d6 d6 d6 00
    439 00 1f 00 00 fa fa fa 00 d6 d6 d6 d6 d6 d6 d6 92
    440 fb fb fb 92 92 fa fa fa fa fa fa fa fa fa fa fa
    441 fa fa fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00
    442 00 fa 00 00 00 fa fa fa 00 d6 d6 d6 d6 d6 00 fa
    443 fa 1f fa fa fa fa fa fa 00 d6 d6 d6 d6 fb fb fb
    444 fb fb fb fb fb fb fa fa 00 00 00 fa fa fa fa fa
    445 fa fa fa fa fa fa fa ff 00 fa fa fa fa fa fa fa
    446 fa fa fa fa fa fa fa fa fa 00 00 00 00 00 fa fa
    447 fa 1f fa fa fa fa fa fa fa 00 00 00 00 00 fa 92
    448 fb fb fb 92 fa fa fa fa ff ff 00 fa 00 00 00 00
    449 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    450 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 1f
    451 1f 1f 1f 1f fa fa fa fa fa fa fa fa fa fa ff fb
    452 fa fb fa fb 92 fa fa fa ff ff 00 fa 00 00 00 00
    453 00 00 fa fa fa fa 92 92 92 92 92 92 92 92 92 92
    454 92 92 92 92 92 92 fa fa fa fa fa fa fa fa fa fa
    455 1f 1f 1f fa fa fa fa fa fa fa fa fa fa fa fb fa
    456 fa fb fa fa fb fa fa fa ff ff 00 fa fa fa fa fa
    457 fa fa fa fa fa fa 92 ff ff 92 ff ff ff ff 92 ff
    458 ff 92 ff ff ff 92 fa fa fa fa fa fa fa fa fa fa
    459 fa 1f fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    460 fa fb fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    461 fa fa fa fa fa fa 92 92 92 92 92 92 92 92 92 92
    462 92 92 92 92 92 92
    463 '}
    464 
     230/* BINRES pd32_portrait.ico */
     231PD32_PORTRAIT ICON
     232{
     233'00 00 01 00 01 00 20 20 10 00 00 00 00 00 e8 02'
     234'00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     235'00 00 01 00 04 00 00 00 00 00 80 02 00 00 00 00'
     236'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     237'00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
     238'00 00 80 00 80 00 80 80 00 00 c0 c0 c0 00 80 80'
     239'80 00 00 00 ff 00 00 ff 00 00 00 ff ff 00 ff 00'
     240'00 00 ff 00 ff 00 ff ff 00 00 ff ff ff 00 00 00'
     241'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     242'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     243'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     244'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     245'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     246'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     247'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     248'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     249'ff f0 00 00 ff ff ff 00 00 00 ff ff 00 00 00 00'
     250'ff ff 00 ff ff ff ff ff 00 0f ff ff 00 00 00 00'
     251'ff ff f0 ff ff ff ff ff 00 ff ff ff 00 00 00 00'
     252'ff ff f0 0f ff ff ff f0 00 ff ff ff 00 00 00 00'
     253'ff ff ff 0f ff ff ff f0 0f ff ff ff 00 00 00 00'
     254'ff ff ff 00 00 00 00 00 0f ff ff ff 00 00 00 00'
     255'ff ff ff f0 ff ff ff 00 ff ff ff ff 00 00 00 00'
     256'ff ff ff f0 0f ff f0 00 ff ff ff ff 00 00 00 00'
     257'ff ff ff ff 0f ff f0 0f ff ff ff ff 00 00 00 00'
     258'ff ff ff ff 00 ff 00 0f ff ff ff ff 00 00 00 00'
     259'ff ff ff ff f0 ff 00 ff ff ff ff ff 00 00 00 00'
     260'ff ff ff ff f0 00 00 ff ff ff ff ff 00 00 00 00'
     261'ff ff ff ff ff 00 0f ff ff ff ff ff 00 00 00 00'
     262'ff ff ff ff ff 00 0f ff ff ff ff ff 00 00 00 00'
     263'ff ff ff ff ff f0 ff ff ff ff ff ff 00 00 00 00'
     264'ff ff ff ff ff f0 ff ff ff ff ff ff 00 00 00 00'
     265'ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00'
     266'ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00'
     267'ff ff ff ff ff ff ff ff ff 0f ff f0 00 00 00 00'
     268'ff ff ff ff ff ff ff ff ff 0f ff 00 00 00 00 00'
     269'ff ff ff ff ff ff ff ff ff 0f f0 00 00 00 00 00'
     270'ff ff ff ff ff ff ff ff ff 0f 00 00 00 00 00 00'
     271'ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00'
     272'00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0 00'
     273'00 07 e0 00 00 07 e0 00 00 07 e0 00 00 07 e0 00'
     274'00 07 e0 00 00 07 e0 00 00 07 e0 00 00 07 e0 00'
     275'00 07 e0 00 00 07 e0 00 00 07 e0 00 00 07 e0 00'
     276'00 07 e0 00 00 07 e0 00 00 07 e0 00 00 07 e0 00'
     277'00 07 e0 00 00 07 e0 00 00 07 e0 00 00 07 e0 00'
     278'00 07 e0 00 00 07 e0 00 00 07 e0 00 00 07 e0 00'
     279'00 07 e0 00 00 07 e0 00 00 0f e0 00 00 1f e0 00'
     280'00 3f e0 00 00 7f e0 00 00 ff e0 00 01 ff'
     281}
     282
     283/* BINRES pd32_landscape.ico */
     284PD32_LANDSCAPE ICON
     285{
     286'00 00 01 00 01 00 20 20 10 00 00 00 00 00 e8 02'
     287'00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     288'00 00 01 00 04 00 00 00 00 00 80 02 00 00 00 00'
     289'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     290'00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
     291'00 00 80 00 80 00 80 80 00 00 c0 c0 c0 00 80 80'
     292'80 00 00 00 ff 00 00 ff 00 00 00 ff ff 00 ff 00'
     293'00 00 ff 00 ff 00 ff ff 00 00 ff ff ff 00 00 00'
     294'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     295'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     296'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     297'00 00 00 00 00 00 00 00 00 00 00 00 00 00 0f ff'
     298'ff ff ff ff ff ff ff ff ff ff ff ff ff f0 0f ff'
     299'ff ff ff ff ff ff ff ff ff ff ff ff ff f0 0f ff'
     300'ff ff ff ff ff ff ff ff ff ff ff ff ff f0 0f ff'
     301'ff ff ff ff ff ff ff ff ff ff ff ff ff f0 0f ff'
     302'ff ff ff ff ff ff ff ff ff ff ff ff ff f0 0f ff'
     303'ff f0 00 00 ff ff ff 00 00 00 ff ff ff f0 0f ff'
     304'ff ff 00 ff ff ff ff ff 00 0f ff ff ff f0 0f ff'
     305'ff ff f0 ff ff ff ff ff 00 ff ff ff ff f0 0f ff'
     306'ff ff f0 0f ff ff ff f0 00 ff ff ff ff f0 0f ff'
     307'ff ff ff 0f ff ff ff f0 0f ff ff ff ff f0 0f ff'
     308'ff ff ff 00 00 00 00 00 0f ff ff ff ff f0 0f ff'
     309'ff ff ff f0 ff ff ff 00 ff ff ff ff ff f0 0f ff'
     310'ff ff ff f0 0f ff f0 00 ff ff ff ff ff f0 0f ff'
     311'ff ff ff ff 0f ff f0 0f ff ff ff ff ff f0 0f ff'
     312'ff ff ff ff 00 ff 00 0f ff ff ff ff ff f0 0f ff'
     313'ff ff ff ff f0 ff 00 ff ff ff ff ff ff f0 0f ff'
     314'ff ff ff ff f0 00 00 ff ff ff ff ff ff f0 0f ff'
     315'ff ff ff ff ff 00 0f ff ff ff ff ff ff f0 0f ff'
     316'ff ff ff ff ff 00 0f ff ff ff f0 00 00 00 0f ff'
     317'ff ff ff ff ff f0 ff ff ff ff f0 ff ff 00 0f ff'
     318'ff ff ff ff ff f0 ff ff ff ff f0 ff f0 00 0f ff'
     319'ff ff ff ff ff ff ff ff ff ff f0 ff 00 00 0f ff'
     320'ff ff ff ff ff ff ff ff ff ff f0 f0 00 00 0f ff'
     321'ff ff ff ff ff ff ff ff ff ff f0 00 00 00 00 00'
     322'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     323'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     324'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     325'00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff'
     326'ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00'
     327'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     328'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     329'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     330'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     331'00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00'
     332'00 03 00 00 00 07 00 00 00 0f 00 00 00 1f 00 00'
     333'00 3f ff ff ff ff ff ff ff ff ff ff ff ff'
     334}
     335
     336/* BINRES 800.bmp */
     337800 BITMAP DISCARDABLE LOADONCALL
     338{
     339 '42 4D 36 05 00 00 00 00 00 00 36 04 00 00 28 00'
     340 '00 00 10 00 00 00 10 00 00 00 01 00 08 00 00 00'
     341 '00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01'
     342 '00 00 00 01 00 00 00 00 00 00 00 00 80 00 00 80'
     343 '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
     344 '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
     345 '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
     346 '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
     347 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     348 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     349 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     350 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     351 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     352 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     353 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     354 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     355 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     356 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     357 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     358 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     359 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     360 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     361 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     362 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     363 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     364 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     365 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     366 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     367 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     368 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     369 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     370 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     371 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     372 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     373 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     374 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     375 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     376 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     377 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     378 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     379 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     380 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     381 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     382 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     383 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     384 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     385 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     386 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     387 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     388 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     389 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     390 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     391 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     392 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     393 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     394 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     395 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     396 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     397 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     398 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     399 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     400 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     401 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     402 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     403 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     404 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     405 '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     406 '00 00 00 00 00 00 07 00 00 00 00 00 07 07 00 00'
     407 '00 00 00 00 07 07 07 00 0B 0B 0B 00 07 07 00 0B'
     408 '0B 03 03 00 07 07 07 00 0B 0B 0B 00 07 07 00 0B'
     409 '0B 03 03 00 07 07 07 00 0B 0B 0B 00 07 07 00 0B'
     410 '0B 03 03 00 07 07 07 00 0B 0B 0B 00 07 07 00 0B'
     411 '0B 03 03 00 07 07 07 00 0B 0B 0B 00 00 00 00 0B'
     412 '0B 03 03 00 07 07 07 00 0B 0B 0B 0B 0B 0B 0B 0B'
     413 '0B 03 03 00 07 07 00 00 0B 0B 0B 0B 0B 0B 0B 0B'
     414 '0B 03 03 00 00 07 00 0B 0B 0B 0B 0B 0B 0B 0B 0B'
     415 '0B 03 03 03 00 07 07 00 0B 0B 0B 0B 0B 0B 0B 0B'
     416 '0B 03 03 00 07 07 07 00 00 0B 0B 0B 0B 0B 0B 0B'
     417 '03 03 00 07 07 07 07 00 07 00 0B 0B 0B 0B 0B 03'
     418 '03 00 07 07 07 07 07 00 07 07 00 0B 0B 0B 03 03'
     419 '00 07 07 07 07 07 07 00 07 07 07 00 00 00 00 00'
     420 '07 07 07 07 07 07 07 07 07 07 07 07 00 00 00 07'
     421 '07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07'
     422 '07 07 07 07 07 07'
     423}
  • trunk/src/comdlg32/comdlg32.cpp

    r3223 r4511  
    1 /* $Id: comdlg32.cpp,v 1.25 2000-03-24 18:22:55 achimha Exp $ */
     1/* $Id: comdlg32.cpp,v 1.26 2000-10-21 18:42:13 sandervl Exp $ */
    22
    33/*
     
    2626ODINDEBUGCHANNEL(COMDLG32-COMDLG32)
    2727
    28 // this controls whether we want to use the Open32 OS/2 file dialogs
    29 // or our own Win95 like file dialogs
    30 #define useWinFileDlg 1
    31 
    32 #if 0
    33 #define COMDLG32_CHECKHOOK(a,b,c)           \
    34   if(a->Flags & b)                          \
    35   {                                         \
    36     wndproc = CreateWindowProc((WNDPROC)a->lpfnHook);\
    37     if(wndproc == NULL)                     \
    38       return(FALSE);                        \
    39                                             \
    40     a->lpfnHook = (c)Win32WindowProc::GetOS2Callback();\
    41   } \
    42   a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    43 
    44 #define COMDLG32_CHECKHOOK2(a,b,c,d)        \
    45   if(a->Flags & b)                          \
    46   {                                         \
    47     wndproc = CreateWindowProc((WNDPROC)a->d);\
    48     if(wndproc == NULL)                     \
    49       return(FALSE);                        \
    50                                             \
    51     a->d = (c)Win32WindowProc::GetOS2Callback();\
    52   } \
    53   a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    54 #else
     28
    5529#define COMDLG32_CHECKHOOK(a,b,c)           \
    5630  if(a->Flags & b)                          \
     
    6640  } \
    6741  a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
    68 #endif
    69 
    70 
    71 /*****************************************************************************
    72  * Name      : iFileDlg_ScanFilterToken
    73  * Purpose   : scan for valid / invalid filter tokens and
    74  *             advance array pointer
    75  * Parameters:
    76  * Variables :
    77  * Result    :
    78  * Remark    :
    79  * Status    :
    80  *
    81  * Author    :
    82  *****************************************************************************/
    83 
    84 // scan filter tokens for validity
    85 static BOOL iFileDlg_ScanFilterToken( LPSTR *plpstrPair )
    86 {
    87   LPSTR lpstrTemp;
    88   LPSTR lpstrNext;
    89   BOOL  fOK = TRUE;
    90 
    91   lpstrTemp = *plpstrPair;
    92   if (lpstrTemp[0] != 0)
    93   {
    94     // get filter description
    95     lpstrTemp = lpstrTemp + strlen(lpstrTemp);
    96     lpstrNext = lpstrTemp + 1;
    97     if (lpstrNext[0] == 0)
    98       fOK = FALSE;
    99     else
    100     {
    101       // get filter mask
    102       lpstrTemp = lpstrNext;
    103       lpstrTemp = lpstrTemp + strlen(lpstrTemp);
    104       lpstrTemp++;
    105     }
    106 
    107     if (fOK)
    108       *plpstrPair = lpstrTemp;
    109   }
    110   return fOK;
    111 }
    112 
    113 
    114 /*****************************************************************************
    115  * Name      : iFileDlg_CleanFilterArray
    116  * Purpose   : remove erroneous array entries at the end to prevent
    117  *             Open32 complain about them but open the file dialog
    118  *             instead.
    119  * Parameters:
    120  * Variables :
    121  * Result    :
    122  * Remark    :
    123  * Status    :
    124  *
    125  * Author    :
    126  *****************************************************************************/
    127 
    128 static DWORD iFileDlg_CleanFilterArray( LPSTR lpstrFilters)
    129 {
    130    DWORD  dwCount = 0;
    131    LPSTR  lpstrTemp;
    132 
    133    if (lpstrFilters && *lpstrFilters)
    134    {
    135      lpstrTemp = lpstrFilters;
    136      while (lpstrTemp[0] != 0)
    137      {
    138         // if an invalid filter token is found, such as found
    139         // in NT4's Regedit e. g., return number of proper
    140         // filter tokens.
    141         // Here however, as were calling Open32, we need
    142         // to correct the filter array.
    143         if (iFileDlg_ScanFilterToken(&lpstrTemp) == FALSE)
    144         {
    145           //@@@PH two alternative methods:
    146           // - copy array to new, corrected array while scanning tokens
    147           // - just overwrite bogus characters at the end of the array
    148           *lpstrTemp++ = 0; // try string termination
    149           *lpstrTemp   = 0;
    150           return dwCount;
    151         }
    152 
    153         dwCount++;
    154      }
    155    }
    156    return dwCount;
    157 }
    158 
    15942
    16043/*****************************************************************************
     
    17356              LPOPENFILENAMEA, lpofn)
    17457{
    175   if(useWinFileDlg || (lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))) {
    176    return GetFileDialog95A(lpofn, SAVE_DIALOG);
    177   }
    178 
    179   COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
    180 
    181   //Note: fix IBM's proper error checking for NT's lazy check
    182   if (lpofn->lpstrFilter != NULL)
    183     iFileDlg_CleanFilterArray((LPSTR)lpofn->lpstrFilter);
    184 
    185   return(O32_GetSaveFileName(lpofn));
     58  return GetFileDialog95A(lpofn, SAVE_DIALOG);
    18659}
    18760
     
    20275              LPOPENFILENAMEW, lpofn)
    20376{
    204   OPENFILENAMEA   ofn;
    205   char*           szFile;
    206   char*           szFileTitle;
    207   char*           szCustFilter;
    208   BOOL            bResult;
    209 
    210   if(useWinFileDlg || (lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))) {
    211    return GetFileDialog95W(lpofn, SAVE_DIALOG);
    212   }
    213 
    214   memcpy(&ofn,          // make binary copy first to save all the fields
    215          lpofn,
    216          sizeof(ofn));
    217 
    218     // convert to ASCII string
    219   if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
    220       (lpofn->lpTemplateName != NULL))
    221     ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
    222   else
    223     ofn.lpTemplateName = NULL;
    224 
    225   if (lpofn->lpstrFilter != NULL)
    226     ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
    227 
    228   if (lpofn->lpstrInitialDir != NULL)
    229     ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
    230 
    231   if (lpofn->lpstrTitle != NULL)
    232     ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
    233 
    234   if (lpofn->lpstrDefExt != NULL)
    235     ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
    236 
    237   szFile             = (char*)malloc(lpofn->nMaxFile);
    238   szFile[0]          = 0;
    239 
    240   if (*lpofn->lpstrFile != 0)
    241     UnicodeToAscii(lpofn->lpstrFile,
    242                    szFile);
    243 
    244   if (lpofn->lpstrFileTitle != NULL)
    245   {
    246     szFileTitle        = (char*)malloc(lpofn->nMaxFileTitle);
    247     szFileTitle[0]     = 0;
    248 
    249     if (*lpofn->lpstrFileTitle != 0)
    250       UnicodeToAscii(lpofn->lpstrFileTitle,
    251                      szFileTitle);
    252   }
    253   else
    254     szFileTitle = NULL;
    255 
    256   if (lpofn->lpstrCustomFilter != NULL)
    257   {
    258     szCustFilter       = (char*)malloc(lpofn->nMaxCustFilter);
    259     szCustFilter[0]    = 0;
    260 
    261 
    262     if (*lpofn->lpstrCustomFilter != 0)
    263        UnicodeToAscii(lpofn->lpstrCustomFilter,
    264                       szCustFilter);
    265   }
    266   else
    267     szCustFilter = NULL;
    268 
    269   ofn.lpstrFile         = szFile;
    270   ofn.lpstrFileTitle    = szFileTitle;
    271   ofn.lpstrCustomFilter = szCustFilter;
    272 
    273   // call ascii variant of function
    274   // @@@PH switch to ODIN_GetSaveFileNameA later
    275   bResult = GetSaveFileNameA(&ofn);
    276 
    277   if (ofn.lpTemplateName    != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
    278   if (ofn.lpstrFilter       != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
    279   if (ofn.lpstrInitialDir   != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
    280   if (ofn.lpstrTitle        != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
    281   if (ofn.lpstrDefExt       != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
    282 
    283   // transform back the result
    284   AsciiToUnicode(ofn.lpstrFile,
    285                  lpofn->lpstrFile);
    286   free(szFile);
    287 
    288   if (lpofn->lpstrFileTitle != NULL)
    289   {
    290     AsciiToUnicode(ofn.lpstrFileTitle,
    291                    lpofn->lpstrFileTitle);
    292     free(szFileTitle);
    293   }
    294 
    295   if (lpofn->lpstrCustomFilter != NULL)
    296   {
    297     AsciiToUnicode(ofn.lpstrCustomFilter,
    298                    lpofn->lpstrCustomFilter);
    299     free(szCustFilter);
    300   }
    301 
    302   // copy over some altered flags
    303   lpofn->nFilterIndex   = ofn.nFilterIndex;
    304   lpofn->Flags          = ofn.Flags;
    305   lpofn->nFileOffset    = ofn.nFileOffset;
    306   lpofn->nFileExtension = ofn.nFileExtension;
    307 
    308   return bResult;
     77  return GetFileDialog95W(lpofn, SAVE_DIALOG);
    30978}
    31079
     
    32493              LPOPENFILENAMEA, lpofn)
    32594{
    326   BOOL rc;
    327 
    328   CheckCurFS();
    329   if(useWinFileDlg || (lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)))
    330   {
    331     return GetFileDialog95A(lpofn, OPEN_DIALOG);
    332   }
    333   COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
    334 
    335   //Note: fix IBM's proper error checking for NT's lazy check
    336   if (lpofn->lpstrFilter != NULL)
    337     iFileDlg_CleanFilterArray((LPSTR)lpofn->lpstrFilter);
    338 
    339   rc = O32_GetOpenFileName(lpofn);
    340   CheckCurFS();
    341   return rc;
     95  return GetFileDialog95A(lpofn, OPEN_DIALOG);
    34296}
    34397
     
    357111              LPOPENFILENAMEW, lpofn)
    358112{
    359   OPENFILENAMEA   ofn;
    360   char*           szFile;
    361   char*           szFileTitle;
    362   char*           szCustFilter;
    363   BOOL            bResult;
    364 
    365   if(useWinFileDlg || (lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))) {
    366    return GetFileDialog95W(lpofn, OPEN_DIALOG);
    367   }
    368 
    369   memcpy(&ofn,          // make binary copy first to save all the fields
    370          lpofn,
    371          sizeof(ofn));
    372 
    373     // convert to ASCII string
    374   if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
    375       (lpofn->lpTemplateName != NULL))
    376     ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
    377   else
    378     ofn.lpTemplateName = NULL;
    379 
    380   if (lpofn->lpstrFilter != NULL)
    381     ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
    382 
    383   if (lpofn->lpstrInitialDir != NULL)
    384     ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
    385 
    386   if (lpofn->lpstrTitle != NULL)
    387     ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
    388 
    389   if (lpofn->lpstrDefExt != NULL)
    390     ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
    391 
    392   szFile             = (char*)malloc(lpofn->nMaxFile);
    393   szFile[0]          = 0;
    394 
    395   if (*lpofn->lpstrFile != 0)
    396     UnicodeToAscii(lpofn->lpstrFile,
    397                    szFile);
    398 
    399   if (lpofn->lpstrFileTitle != NULL)
    400   {
    401     szFileTitle        = (char*)malloc(lpofn->nMaxFileTitle);
    402     szFileTitle[0]     = 0;
    403 
    404     if (*lpofn->lpstrFileTitle != 0)
    405       UnicodeToAscii(lpofn->lpstrFileTitle,
    406                      szFileTitle);
    407   }
    408   else
    409     szFileTitle = NULL;
    410 
    411   if (lpofn->lpstrCustomFilter != NULL)
    412   {
    413     szCustFilter       = (char*)malloc(lpofn->nMaxCustFilter);
    414     szCustFilter[0]    = 0;
    415 
    416 
    417     if (*lpofn->lpstrCustomFilter != 0)
    418        UnicodeToAscii(lpofn->lpstrCustomFilter,
    419                       szCustFilter);
    420   }
    421   else
    422     szCustFilter = NULL;
    423 
    424   ofn.lpstrFile         = szFile;
    425   ofn.lpstrFileTitle    = szFileTitle;
    426   ofn.lpstrCustomFilter = szCustFilter;
    427 
    428   // call ascii variant of function
    429   // @@@PH switch to ODIN_GetOpenFileNameA later
    430   bResult = GetOpenFileNameA(&ofn);
    431 
    432   if (ofn.lpTemplateName    != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
    433   if (ofn.lpstrFilter       != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
    434   if (ofn.lpstrInitialDir   != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
    435   if (ofn.lpstrTitle        != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
    436   if (ofn.lpstrDefExt       != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
    437 
    438   // transform back the result
    439   AsciiToUnicode(ofn.lpstrFile,
    440                  lpofn->lpstrFile);
    441   free(szFile);
    442 
    443   if (lpofn->lpstrFileTitle != NULL)
    444   {
    445     AsciiToUnicode(ofn.lpstrFileTitle,
    446                    lpofn->lpstrFileTitle);
    447     free(szFileTitle);
    448   }
    449 
    450   if (lpofn->lpstrCustomFilter != NULL)
    451   {
    452     AsciiToUnicode(ofn.lpstrCustomFilter,
    453                    lpofn->lpstrCustomFilter);
    454     free(szCustFilter);
    455   }
    456 
    457   // copy over some altered flags
    458   lpofn->nFilterIndex   = ofn.nFilterIndex;
    459   lpofn->Flags          = ofn.Flags;
    460   lpofn->nFileOffset    = ofn.nFileOffset;
    461   lpofn->nFileExtension = ofn.nFileExtension;
    462 
    463   return bResult;
    464 }
    465 
     113  return GetFileDialog95W(lpofn, OPEN_DIALOG);
     114}
     115
     116#if 0
    466117/*****************************************************************************
    467118 * Name      :
     
    679330  return O32_CommDlgExtendedError();
    680331}
    681 
    682332
    683333/*****************************************************************************
     
    806456  return iResult;
    807457}
     458#endif
    808459
    809460/*****************************************************************************
     
    887538
    888539
     540#if 0
    889541/*****************************************************************************
    890542 * Name      :
     
    979631  return bResult;
    980632}
    981 
     633#endif
    982634
    983635/*****************************************************************************
  • trunk/src/comdlg32/comdlg32.def

    r2223 r4511  
    1 ; $Id: comdlg32.def,v 1.5 1999-12-28 10:30:59 sandervl Exp $
     1; $Id: comdlg32.def,v 1.6 2000-10-21 18:42:13 sandervl Exp $
    22
    33;
     
    1212    ChooseFontA                = _ChooseFontA@4              @103
    1313    ChooseFontW                = _ChooseFontW@4              @104
    14     CommDlgExtendedError       = _CommDlgExtendedError32@0   @105
     14    CommDlgExtendedError       = _CommDlgExtendedError@0     @105
    1515    FindTextA                  = _FindTextA@4                @106
    1616    FindTextW                  = _FindTextW@4                @107
    17     GetFileTitleA              = _GetFileTitleA32@12         @108
    18     GetFileTitleW              = _GetFileTitleW32@12         @109
     17    GetFileTitleA              = _GetFileTitleA@12           @108
     18    GetFileTitleW              = _GetFileTitleW@12           @109
    1919    GetOpenFileNameA           = _GetOpenFileNameA@4         @110
    2020    GetOpenFileNameW           = _GetOpenFileNameW@4         @111
  • trunk/src/comdlg32/filedlg95.c

    r4089 r4511  
    1 /* $Id: filedlg95.c,v 1.14 2000-08-24 12:02:23 sandervl Exp $*/
    21/*
    32 * COMMDLG - File Open Dialogs Win95 look and feel
    43 *
    5  * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
    6  * Project Odin Software License can be found in LICENSE.TXT
    7  *
    8  * Corel WINE 20000324 level
     4 * FIXME: lpstrCustomFilter not handled
     5 *
     6 * FIXME: if the size of lpstrFile (nMaxFile) is to small the first
     7 * two bytes of lpstrFile should contain the needed size
     8 *
     9 * FIXME: algorithm for selecting the initial directory is too simple
     10 *
     11 * FIXME: add to recent docs
     12 *
     13 * FIXME: flags not implemented: OFN_CREATEPROMPT, OFN_DONTADDTORECENT,
     14 * OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, OFN_EXTENSIONDIFFERENT,
     15 * OFN_NOCHANGEDIR, OFN_NODEREFERENCELINKS, OFN_READONLYRETURN,
     16 * OFN_NOTESTFILECREATE, OFN_OVERWRITEPROMPT, OFN_USEMONIKERS
     17 *
     18 * FIXME: lCustData for lpfnHook (WM_INITDIALOG)
     19 *
     20 *
    921 */
    1022#ifdef __WIN32OS2__
     
    2436#include <ctype.h>
    2537#include <stdlib.h>
     38#include <stdio.h>
    2639#include <string.h>
     40
    2741#include "winbase.h"
     42#include "ntddk.h"
     43#include "wine/winestring.h"
    2844#include "ldt.h"
    2945#include "heap.h"
     
    3349#include "debugtools.h"
    3450#include "cderr.h"
     51#include "tweak.h"
    3552#include "winnls.h"
    3653#include "shellapi.h"
    37 #include "tchar.h"
     54#include "shlguid.h"
    3855#include "filedlgbrowser.h"
     56#include "shlwapi.h"
    3957#include "wine/obj_contextmenu.h"
    4058
    41 DEFAULT_DEBUG_CHANNEL(commdlg)
     59DEFAULT_DEBUG_CHANNEL(commdlg);
    4260
    4361/***********************************************************************
     
    4664typedef struct SFolder
    4765{
    48   int          m_iImageIndex;    /* Index of picture in image list */
    49   HIMAGELIST   hImgList;
    50   int          m_iIndent;      /* Indentation index */
    51   LPITEMIDLIST pidlItem;  /* absolute pidl of the item */
    52   CHAR*        szDisplayName;
    53   INT          iIcon;
    54   INT          iSelIcon;
    55   HIMAGELIST   ilItemImage;
     66  int m_iImageIndex;    /* Index of picture in image list */
     67  HIMAGELIST hImgList;
     68  int m_iIndent;      /* Indentation index */
     69  LPITEMIDLIST pidlItem;  /* absolute pidl of the item */
    5670
    5771} SFOLDER,*LPSFOLDER;
     
    139153static void    FILEDLG95_Clean(HWND hwnd);
    140154
    141 /* Functions used by the shell object */
     155/* Functions used by the shell navigation */
    142156static LRESULT FILEDLG95_SHELL_Init(HWND hwnd);
    143157static BOOL    FILEDLG95_SHELL_UpFolder(HWND hwnd);
    144158static BOOL    FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb);
    145 static BOOL    FILEDLG95_SHELL_NewFolder(HWND hwnd);
    146159static void    FILEDLG95_SHELL_Clean(HWND hwnd);
     160static BOOL    FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd);
    147161
    148162/* Functions used by the filetype combo box */
    149163static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd);
    150164static BOOL    FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode);
    151 static int     FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPSTR lpstrExt);
     165static int     FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPCSTR lpstrExt);
    152166static void    FILEDLG95_FILETYPE_Clean(HWND hwnd);
    153167
     
    171185
    172186/* Shell memory allocation */
    173 void *MemAlloc(UINT size);
    174 void MemFree(void *mem);
     187static void *MemAlloc(UINT size);
     188static void MemFree(void *mem);
    175189
    176190BOOL WINAPI GetFileName95(FileOpenDlgInfos *fodInfos);
     
    184198 *      GetFileName95
    185199 *
    186  * Creates an Open common dialog box that lets the user select
     200 * Creates an Open common dialog box that lets the user select 
    187201 * the drive, directory, and the name of a file or set of files to open.
    188202 *
     
    221235    if( lRes == -1)
    222236        return FALSE;
    223 
     237   
    224238    return lRes;
    225239}
     
    228242 *      GetFileDialog95A
    229243 *
    230  * Copy the OPENFILENAMEA structure in a FileOpenDlgInfos structure.
    231244 * Call GetFileName95 with this structure and clean the memory.
    232245 *
     
    235248 */
    236249BOOL  WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
     250{
     251
     252  BOOL ret;
     253  FileOpenDlgInfos *fodInfos;
     254  HINSTANCE hInstance;
     255  LPCSTR lpstrInitialDir = (LPCSTR)-1;
     256  DWORD dwFlags = 0;
     257 
     258  /* Initialise FileOpenDlgInfos structure*/ 
     259  fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
     260  ZeroMemory(fodInfos, sizeof(FileOpenDlgInfos));
     261 
     262  /* Pass in the original ofn */
     263  fodInfos->ofnInfos = ofn;
     264 
     265  /* Save original hInstance value */
     266  hInstance = ofn->hInstance;
     267  fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
     268
     269  dwFlags = ofn->Flags;
     270  ofn->Flags = ofn->Flags|OFN_WINE;
     271
     272  /* Replace the NULL lpstrInitialDir by the current folder */
     273  if(!ofn->lpstrInitialDir)
     274  {
     275    lpstrInitialDir = ofn->lpstrInitialDir;
     276    ofn->lpstrInitialDir = MemAlloc(MAX_PATH);
     277    GetCurrentDirectoryA(MAX_PATH,(LPSTR)ofn->lpstrInitialDir);
     278  }
     279
     280  /* Initialise the dialog property */
     281  fodInfos->DlgInfos.dwDlgProp = 0;
     282  fodInfos->DlgInfos.hwndCustomDlg = (HWND)NULL;
     283 
     284  switch(iDlgType)
     285  {
     286    case OPEN_DIALOG :
     287      ret = GetFileName95(fodInfos);
     288      break;
     289    case SAVE_DIALOG :
     290      fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
     291      ret = GetFileName95(fodInfos);
     292      break;
     293    default :
     294      ret = 0;
     295  }
     296
     297  if (lpstrInitialDir != (LPCSTR)-1)
     298  {
     299    MemFree((LPVOID)(ofn->lpstrInitialDir));
     300    ofn->lpstrInitialDir = lpstrInitialDir;
     301  }
     302
     303  ofn->Flags = dwFlags;
     304  ofn->hInstance = hInstance;
     305  MemFree((LPVOID)(fodInfos));
     306  return ret;
     307}
     308
     309/***********************************************************************
     310 *      GetFileDialog95W
     311 *
     312 * Copy the OPENFILENAMEW structure in a FileOpenDlgInfos structure.
     313 * Call GetFileName95 with this structure and clean the memory.
     314 *
     315 * IN  : The OPENFILENAMEW initialisation structure passed to
     316 *       GetOpenFileNameW win api function (see filedlg.c)
     317 *
     318 * FIXME:
     319 *   some more strings are needing to be convertet AtoW
     320 */
     321BOOL  WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
    237322{
    238323  BOOL ret;
     
    241326  LPCSTR lpstrFilter = NULL;
    242327  LPSTR lpstrCustomFilter = NULL;
    243   LPCSTR lpstrInitialDir = NULL;
    244   DWORD dwFlags = 0;
     328#ifdef __WIN32OS2__
     329  LPWSTR lpstrInitialDir = NULL;
     330  LPWSTR lpstrTitle = NULL;
     331#endif
     332  LPWSTR lpstrFile = NULL;
     333  DWORD dwFlags;
    245334
    246335  /* Initialise FileOpenDlgInfos structure*/
    247336  fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
    248 
    249   /* Pass in the original ofn */
    250   fodInfos->ofnInfos = ofn;
    251 
    252   /* Save original hInstance value */
    253   hInstance = ofn->hInstance;
    254   fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
    255 
    256   if (ofn->lpstrFilter)
    257   {
    258     LPSTR s,x;
    259     lpstrFilter = ofn->lpstrFilter;
    260 
    261     /* filter is a list...  title\0ext\0......\0\0 */
    262     s = (LPSTR)ofn->lpstrFilter;
    263     while (*s)
    264       s = s+strlen(s)+1;
    265     s++;
    266     x = (LPSTR)MemAlloc(s-ofn->lpstrFilter);
    267     memcpy(x,ofn->lpstrFilter,s-ofn->lpstrFilter);
    268     fodInfos->ofnInfos->lpstrFilter = (LPSTR)x;
    269   }
    270   if (ofn->lpstrCustomFilter)
    271   {
    272     LPSTR s,x;
    273     lpstrCustomFilter = ofn->lpstrCustomFilter;
    274 
    275     /* filter is a list...  title\0ext\0......\0\0 */
    276     s = (LPSTR)ofn->lpstrCustomFilter;
    277     while (*s)
    278       s = s+strlen(s)+1;
    279     s++;
    280     x = MemAlloc(s-ofn->lpstrCustomFilter);
    281     memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter);
    282     fodInfos->ofnInfos->lpstrCustomFilter = (LPSTR)x;
    283   }
    284 
    285   dwFlags = ofn->Flags;
    286   fodInfos->ofnInfos->Flags = ofn->Flags|OFN_WINE;
    287 
    288   /* Replace the NULL lpstrInitialDir by the current folder */
    289   lpstrInitialDir = ofn->lpstrInitialDir;
    290   if(!lpstrInitialDir || *lpstrInitialDir == 0)
    291   {
    292     fodInfos->ofnInfos->lpstrInitialDir = MemAlloc(MAX_PATH);
    293     GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos->lpstrInitialDir);
    294   }
    295 
    296   /* Initialise the dialog property */
    297   fodInfos->DlgInfos.dwDlgProp = 0;
    298   fodInfos->DlgInfos.hwndCustomDlg = (HWND)NULL;
    299 
    300   switch(iDlgType)
    301   {
    302   case OPEN_DIALOG :
    303       ret = GetFileName95(fodInfos);
    304       break;
    305   case SAVE_DIALOG :
    306       fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
    307       ret = GetFileName95(fodInfos);
    308       break;
    309   default :
    310       ret = 0;
    311   }
    312 
    313   if (lpstrInitialDir)
    314   {
    315     MemFree((LPVOID)(fodInfos->ofnInfos->lpstrInitialDir));
    316     fodInfos->ofnInfos->lpstrInitialDir = lpstrInitialDir;
    317       }
    318   if (lpstrFilter)
    319   {
    320     MemFree((LPVOID)(fodInfos->ofnInfos->lpstrFilter));
    321     fodInfos->ofnInfos->lpstrFilter = lpstrFilter;
    322   }
    323   if (lpstrCustomFilter)
    324   {
    325     MemFree((LPVOID)(fodInfos->ofnInfos->lpstrCustomFilter));
    326     fodInfos->ofnInfos->lpstrCustomFilter = lpstrCustomFilter;
    327   }
    328 
    329   ofn->Flags = dwFlags;
    330   ofn->hInstance = hInstance;
    331   MemFree((LPVOID)(fodInfos));
    332   return ret;
    333 }
    334 
    335 /***********************************************************************
    336  *      GetFileDialog95W
    337  *
    338  * Copy the OPENFILENAMEW structure in a FileOpenDlgInfos structure.
    339  * Call GetFileName95 with this structure and clean the memory.
    340  *
    341  * IN  : The OPENFILENAMEW initialisation structure passed to
    342  *       GetOpenFileNameW win api function (see filedlg.c)
    343  */
    344 BOOL  WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
    345 {
    346   BOOL ret;
    347   FileOpenDlgInfos *fodInfos;
    348   HINSTANCE hInstance;
    349   LPCSTR lpstrFilter = NULL;
    350   LPSTR lpstrCustomFilter = NULL;
    351   LPWSTR lpstrFile = NULL;
    352   LPWSTR lpstrInitialDir = NULL;
    353   LPWSTR lpstrTitle = NULL;
    354   DWORD dwFlags;
    355 
    356   /* Initialise FileOpenDlgInfos structure*/
    357   fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
     337  ZeroMemory(fodInfos, sizeof(FileOpenDlgInfos));
    358338
    359339  /*  Pass in the original ofn */
    360   fodInfos->ofnInfos = (LPOPENFILENAMEA)ofn;
     340  fodInfos->ofnInfos = (LPOPENFILENAMEA) ofn;
    361341
    362342  /* Save hInstance */
     
    375355    /* filter is a list...  title\0ext\0......\0\0 */
    376356    s = (LPWSTR)ofn->lpstrFilter;
    377 
     357   
    378358    while (*s)
    379359      s = s+lstrlenW(s)+1;
     
    384364    while (*s) {
    385365      lstrcpyWtoA(x,s);
    386       x+=lstrlenA(x)+1;
     366      x+=strlen(x)+1;
    387367      s+=lstrlenW(s)+1;
    388368    }
     
    408388    while (*s) {
    409389      lstrcpyWtoA(x,s);
    410       x+=lstrlenA(x)+1;
     390      x+=strlen(x)+1;
    411391      s+=lstrlenW(s)+1;
    412392    }
     
    421401  /* Initialise the dialog property */
    422402  fodInfos->DlgInfos.dwDlgProp = 0;
    423 
     403 
    424404  /* allocate ansi filename buffer */
    425405  lpstrFile = ofn->lpstrFile; 
    426406  ofn->lpstrFile = MemAlloc(ofn->nMaxFile);
    427407
     408#ifdef __WIN32OS2__
    428409  // convert initial dir & title (if necessary)
    429410  lpstrInitialDir = (LPWSTR)ofn->lpstrInitialDir;
     
    446427  }
    447428
     429#endif
     430 
    448431  switch(iDlgType)
    449432  {
     
    458441      ret = 0;
    459442  }
    460 
     443     
    461444  /* Cleaning */
    462445  /* Restore Flags */
     
    484467  ofn->lpstrFile = lpstrFile;
    485468
     469#ifdef __WIN32OS2__
    486470  //free converted initial dir & title strings
    487471  if(lpstrInitialDir) {
     
    493477        ofn->lpstrTitle = (LPCWSTR)lpstrTitle;
    494478  }
     479#endif
     480
    495481  return ret;
    496482}
     
    499485{
    500486
    501         HWND hwndChild,hwndStc32;
    502         RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp;
    503         POINT ptMoveCtl;
    504         POINT ptParentClient;
    505 
    506         ptMoveCtl.x = ptMoveCtl.y = 0;
    507         hwndStc32=GetDlgItem(hwndChildDlg,stc32);
    508         GetClientRect(hwndParentDlg,&rectParent);
    509         GetClientRect(hwndChildDlg,&rectChild);
    510         if(hwndStc32)
    511         {
    512                 GetWindowRect(hwndStc32,&rectStc32);
    513                 MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
    514                 CopyRect(&rectTemp,&rectStc32);
    515 
    516                 SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
    517                 SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
    518 
    519                 if(rectStc32.right < rectTemp.right)
    520                 {
    521                         ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
    522                         ptMoveCtl.x = 0;
    523                 }
    524                 else
    525                 {
    526                         ptMoveCtl.x = (rectStc32.right - rectTemp.right);
    527                         ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
    528                 }
    529                 if(rectStc32.bottom < rectTemp.bottom)
    530                 {
    531                         ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
    532                         ptMoveCtl.y = 0;
    533                 }
    534                 else
    535                 {
    536                         ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
    537                         ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
    538                 }
    539         }
    540         else
    541         {
    542                 if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL)
     487        HWND hwndChild,hwndStc32;
     488        RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp;
     489        POINT ptMoveCtl;
     490        POINT ptParentClient;
     491
     492        ptMoveCtl.x = ptMoveCtl.y = 0;
     493        hwndStc32=GetDlgItem(hwndChildDlg,stc32);
     494        GetClientRect(hwndParentDlg,&rectParent);
     495        GetClientRect(hwndChildDlg,&rectChild);
     496        if(hwndStc32)
     497        {
     498                GetWindowRect(hwndStc32,&rectStc32);
     499                MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     500                CopyRect(&rectTemp,&rectStc32);
     501
     502                SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
     503                SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
     504
     505                if(rectStc32.right < rectTemp.right)
     506                {
     507                        ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
     508                        ptMoveCtl.x = 0;
     509                }
     510                else
     511                {
     512                        ptMoveCtl.x = (rectStc32.right - rectTemp.right);
     513                        ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
     514                }
     515                if(rectStc32.bottom < rectTemp.bottom)
     516                {
     517                        ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
     518                        ptMoveCtl.y = 0;
     519                }
     520                else
     521                {
     522                        ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
     523                        ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
     524                }
     525        }
     526        else
     527        {
     528                if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL)
    543529                   return;
    544                 ptParentClient.x = rectParent.right-rectParent.left;
    545                 ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
    546                 ptMoveCtl.y = rectParent.bottom-rectParent.top;
    547                 ptMoveCtl.x=0;
    548         }
    549         SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
    550         AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
    551 
    552         SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y,
    553                  SWP_NOZORDER );
    554         SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
    555                 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
    556 
    557         hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
    558         if(hwndStc32)
    559         {
    560                 GetWindowRect(hwndStc32,&rectStc32);
    561                 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
    562         }
    563         else
    564                 SetRect(&rectStc32,0,0,0,0);
    565 
    566         if (hwndChild )
    567         {
    568                 do
    569                 {
    570                         if(hwndChild != hwndStc32)
    571                         {
    572                         if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
    573                                 continue;
    574                         GetWindowRect(hwndChild,&rectCtrl);
    575                         MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
    576 
    577                                 /*
    578                                    Check the initial position of the controls relative to the initial
    579                                    position and size of stc32 (before it is expanded).
    580                                 */
    581                 if (rectCtrl.left > rectTemp.right && rectCtrl.top > rectTemp.bottom)
    582                                 {
    583                                         rectCtrl.left += ptMoveCtl.x;
    584                                 rectCtrl.top  += ptMoveCtl.y;
    585                                 }
    586                                 else if (rectCtrl.left > rectTemp.right)
    587                                         rectCtrl.left += ptMoveCtl.x;
    588                                 else if (rectCtrl.top > rectTemp.bottom)
    589                                         rectCtrl.top  += ptMoveCtl.y;
    590 
    591                                 SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
    592                                 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
    593                                 SWP_NOSIZE | SWP_NOZORDER );
    594                                 }
    595                         }
    596                 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
    597         }
    598         hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
    599 
    600         if(hwndStc32)
    601         {
    602                 GetWindowRect(hwndStc32,&rectStc32);
    603                 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
    604                 ptMoveCtl.x = rectStc32.left - 0;
    605                 ptMoveCtl.y = rectStc32.top - 0;
    606                 if (hwndChild )
    607                 {
    608                         do
    609                         {
    610                                 if(hwndChild != hwndChildDlg)
    611                                 {
    612 
    613                                         if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
    614                                                 continue;
    615                                         GetWindowRect(hwndChild,&rectCtrl);
    616                                         MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
    617 
    618                                         rectCtrl.left += ptMoveCtl.x;
    619                                         rectCtrl.top += ptMoveCtl.y;
    620 
    621                                         SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
    622                                         rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
    623                                         SWP_NOSIZE |SWP_NOZORDER );
    624                                 }
    625                         }
    626                         while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
    627                 }
    628         }
     530                SetRectEmpty(&rectTemp);
     531                ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
     532                ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
     533                ptMoveCtl.y = rectParent.bottom-rectParent.top;
     534                ptMoveCtl.x=0;
     535        }
     536        SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
     537        AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
     538
     539        SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y,
     540                 SWP_NOZORDER );
     541        SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
     542                (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
     543       
     544        hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
     545        if(hwndStc32)
     546        {
     547                GetWindowRect(hwndStc32,&rectStc32);
     548                MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     549        }
     550        else
     551                SetRect(&rectStc32,0,0,0,0);
     552
     553        if (hwndChild )
     554        {
     555                do
     556                {
     557                        if(hwndChild != hwndStc32)
     558                        {
     559                        if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
     560                                continue;
     561                        GetWindowRect(hwndChild,&rectCtrl);
     562                        MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
     563                                 
     564                                /*
     565                                   Check the initial position of the controls relative to the initial
     566                                   position and size of stc32 (before it is expanded).
     567                                */
     568                if (rectCtrl.left >= rectTemp.right && rectCtrl.top >= rectTemp.bottom)
     569                                {
     570                                        rectCtrl.left += ptMoveCtl.x;
     571                                rectCtrl.top  += ptMoveCtl.y;
     572                                }
     573                                else if (rectCtrl.left >= rectTemp.right)
     574                                        rectCtrl.left += ptMoveCtl.x;
     575                                else if (rectCtrl.top >= rectTemp.bottom)
     576                                        rectCtrl.top  += ptMoveCtl.y;
     577                                       
     578                                SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
     579                                rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
     580                                SWP_NOSIZE | SWP_NOZORDER );
     581                                }
     582                        }
     583                while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
     584        }               
     585        hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
     586       
     587        if(hwndStc32)
     588        {
     589                GetWindowRect(hwndStc32,&rectStc32);
     590                MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     591                ptMoveCtl.x = rectStc32.left - 0;
     592                ptMoveCtl.y = rectStc32.top - 0;
     593                if (hwndChild )
     594                {
     595                        do
     596                        {
     597                                if(hwndChild != hwndChildDlg)
     598                                {
     599
     600                                        if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
     601                                                continue;
     602                                        GetWindowRect(hwndChild,&rectCtrl);
     603                                        MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
     604
     605                                        rectCtrl.left += ptMoveCtl.x;
     606                                        rectCtrl.top += ptMoveCtl.y;
     607
     608                                        SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
     609                                        rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
     610                                        SWP_NOSIZE |SWP_NOZORDER );
     611                                }
     612                        }
     613                        while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
     614                }               
     615        }
    629616
    630617}
     
    636623  switch(uMsg)
    637624  {
    638         case WM_INITDIALOG:
    639         {
     625        case WM_INITDIALOG:
     626        {         
    640627            fodInfos = (FileOpenDlgInfos *)lParam;
    641                 lParam = (LPARAM)fodInfos->ofnInfos;
    642                 ArrangeCtrlPositions(hwnd,GetParent(hwnd));
     628                lParam = (LPARAM) fodInfos->ofnInfos;
     629                ArrangeCtrlPositions(hwnd,GetParent(hwnd));
    643630            if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook)
    644631                 return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
    645                 return 0;
    646         }
     632                return 0;       
     633        } 
    647634    }
    648635    if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook )
    649         return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
    650   return DefWindowProcA(hwnd,uMsg,wParam,lParam);
     636        return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam); 
     637  return DefWindowProcA(hwnd,uMsg,wParam,lParam); 
    651638}
    652639
     
    659646   if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
    660647   {
    661         if (fodInfos->ofnInfos->Flags  & OFN_ENABLETEMPLATEHANDLE)
    662         {
     648        if (fodInfos->ofnInfos->Flags  & OFN_ENABLETEMPLATEHANDLE)
     649        {
    663650           if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
    664                 {
    665                 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    666                 return (HWND)NULL;
    667                 }
    668 
    669         }
    670         else
    671         {
    672          if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos->hInstance),
     651                {
     652                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     653                return (HWND)NULL;
     654                }
     655               
     656        }
     657        else
     658        {
     659         if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos->hInstance),
    673660            (fodInfos->ofnInfos->lpTemplateName), RT_DIALOGA)))
    674         {
    675                 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    676                  return (HWND)NULL;
    677         }
    678         if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos->hInstance),
     661        {
     662                COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     663                 return (HWND)NULL;
     664        }
     665        if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos->hInstance),
    679666             hRes )) ||
    680667                 !(template = LockResource( hDlgTmpl )))
    681         {
    682                 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    683                 return (HWND)NULL;
    684         }
    685         }
    686 
    687         hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
    688         if(hChildDlg)
    689         {
    690                 ShowWindow(hChildDlg,SW_SHOW);
    691                 return hChildDlg;
    692         }
     668        {
     669                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     670                return (HWND)NULL;
     671        }
     672        }
     673
     674        hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     675        if(hChildDlg)
     676        {
     677                ShowWindow(hChildDlg,SW_SHOW);
     678                return hChildDlg;
     679        }
    693680 }
    694681 else if(fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos->lpfnHook)
    695682 {
    696         RECT rectHwnd;
    697         DLGTEMPLATE tmplate;
    698         GetClientRect(hwnd,&rectHwnd);
    699         tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
    700         tmplate.dwExtendedStyle = 0;
    701         tmplate.cdit = 0;
    702         tmplate.x = 0;
    703         tmplate.y = 0;
    704         tmplate.cx = rectHwnd.right-rectHwnd.left;
    705         tmplate.cy = rectHwnd.bottom-rectHwnd.top;
    706 
    707         return CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     683        RECT rectHwnd;
     684        DLGTEMPLATE tmplate;
     685        GetClientRect(hwnd,&rectHwnd);
     686        tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
     687        tmplate.dwExtendedStyle = 0;
     688        tmplate.cdit = 0;
     689        tmplate.x = 0;
     690        tmplate.y = 0;
     691        tmplate.cx = rectHwnd.right-rectHwnd.left;
     692        tmplate.cy = rectHwnd.bottom-rectHwnd.top;
     693       
     694        return CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
    708695 }
    709696return (HWND)NULL;
    710697}
    711 
     698 
    712699/***********************************************************************
    713700*          SendCustomDlgNotificationMessage
     
    741728{
    742729    LPSTR lpstrFileSpec;
    743     char lpstrCurrentDir[MAX_PATH]="";
     730    int reqSize;
     731    char lpstrPath[MAX_PATH];
    744732    FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    745     if(!fodInfos)
    746         return TRUE;
     733    if(!fodInfos) return -1;
     734
    747735    switch(uMsg)
    748736    {
    749737        case CDM_GETFILEPATH:
    750         {
    751             char lpstrPathSpec[MAX_PATH]="";
    752             GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam);
    753             lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam);
    754             strcpy(lpstrPathSpec,(LPSTR)lParam);
    755             COMDLG32_PathRemoveFileSpecA(lpstrPathSpec);
    756             if(!lpstrPathSpec[0])
    757                 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
    758                 lpstrPathSpec);
    759             strcat(lpstrPathSpec,"\\");
    760             strcat(lpstrPathSpec,(LPSTR)lParam);
    761             strcpy((LPSTR)lParam,(LPSTR)lpstrPathSpec);
    762         }
    763             return TRUE;
     738            GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath));
     739            lpstrFileSpec = (LPSTR)COMDLG32_PathFindFileNameA(lpstrPath);
     740            if (lpstrFileSpec==lpstrPath)
     741            {
     742                char lpstrCurrentDir[MAX_PATH];
     743                /* Prepend the current path */
     744                COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrCurrentDir);
     745                if ((LPSTR)lParam!=NULL)
     746                    wsnprintfA((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath);
     747                reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1;
     748            }
     749            else
     750            {
     751                lstrcpynA((LPSTR)lParam,(LPSTR)lpstrPath,(int)wParam);
     752                reqSize=strlen(lpstrPath);
     753            }
     754            /* return the required buffer size */
     755            return reqSize;
     756
    764757        case CDM_GETFOLDERPATH:
    765             if(lParam)
    766             {
    767                 if(fodInfos)
    768                 {
    769                     COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
    770                     lpstrCurrentDir);
    771                     strncpy((LPSTR)lParam,lpstrCurrentDir,(int)wParam);
    772                 }
    773                 else
    774                 *((LPSTR)lParam)=0;
    775             }
    776             return TRUE;
    777     case CDM_GETSPEC:
    778             if(lParam)
    779             {
    780                 GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam);
    781                 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam);
    782                 if(lpstrFileSpec)
    783                    strcpy((LPSTR)lParam, lpstrFileSpec);
    784                 else
    785                     *((LPSTR)lParam)=0;
    786             }
    787             return TRUE;
     758            COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath);
     759            if ((LPSTR)lParam!=NULL)
     760                lstrcpynA((LPSTR)lParam,lpstrPath,(int)wParam);
     761            return strlen(lpstrPath);
     762
     763        case CDM_GETSPEC:
     764            reqSize=GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath));
     765            lpstrFileSpec = (LPSTR)COMDLG32_PathFindFileNameA(lpstrPath);
     766            if ((LPSTR)lParam!=NULL)
     767                lstrcpynA((LPSTR)lParam, lpstrFileSpec, (int)wParam);
     768            return strlen(lpstrFileSpec);
     769
    788770        case CDM_SETCONTROLTEXT:
    789           if ( 0 != lParam )
    790             SetDlgItemTextA( hwnd, (UINT) wParam, (LPSTR) lParam );
    791           return TRUE;
     771            if ( 0 != lParam )
     772                SetDlgItemTextA( hwnd, (UINT) wParam, (LPSTR) lParam );
     773            return TRUE;
     774
    792775        case CDM_HIDECONTROL:
    793776        case CDM_SETDEFEXT:
    794         FIXME("CDM_HIDECONTROL,CDM_SETCONTROLTEXT,CDM_SETDEFEXT not implemented\n");
    795         return TRUE;
     777            FIXME("CDM_HIDECONTROL,CDM_SETCONTROLTEXT,CDM_SETDEFEXT not implemented\n");
     778            return -1;
    796779    }
    797780    return TRUE;
    798781}
    799 
     782 
    800783/***********************************************************************
    801784 *          FileOpenDlgProc95
     
    807790  switch(uMsg)
    808791  {
    809     case WM_INITDIALOG :
    810          /* Adds the FileOpenDlgInfos in the property list of the dialog
     792    case WM_INITDIALOG:
     793         /* Adds the FileOpenDlgInfos in the property list of the dialog 
    811794            so it will be easily accessible through a GetPropA(...) */
    812         SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam);
    813 
    814         FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
    815          ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg =
    816         CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
     795        SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam);
     796
     797        FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
     798         ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg =
     799        CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
    817800         SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
    818801         return 0;
     
    829812      }
    830813      return FALSE;
    831 
     814         
    832815    case WM_GETISHELLBROWSER:
    833816      return FILEDLG95_OnWMGetIShellBrowser(hwnd);
    834817
    835   case WM_DESTROY:
    836         FILEDLG95_Clean(hwnd);
    837         RemovePropA(hwnd, FileOpenDlgInfosStr);
    838         return FALSE;
     818    case WM_DESTROY:
     819      RemovePropA(hwnd, FileOpenDlgInfosStr);
     820      return FALSE;
    839821
    840822    case WM_NOTIFY:
    841823    {
    842         LPNMHDR lpnmh = (LPNMHDR)lParam;
    843         UINT stringId = -1;
    844 
    845         /* set up the button tooltips strings */
    846         if(TTN_GETDISPINFOA == lpnmh->code )
    847         {
    848             LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam;
    849             switch(lpnmh->idFrom )
    850             {
    851                 /* Up folder button */
    852                 case FCIDM_TB_UPFOLDER:
    853                     stringId = IDS_UPFOLDER;
    854                     break;
    855                 /* New folder button */
    856                 case FCIDM_TB_NEWFOLDER:
    857                     stringId = IDS_NEWFOLDER;
    858                     break;
    859                 /* List option button */
    860                 case FCIDM_TB_SMALLICON:
    861                     stringId = IDS_LISTVIEW;
    862                     break;
    863                 /* Details option button */
    864                 case FCIDM_TB_REPORTVIEW:
    865                     stringId = IDS_REPORTVIEW;
    866                     break;
    867             }
    868             lpdi->hinst = COMMDLG_hInstance32;
    869             lpdi->lpszText =  (LPSTR) stringId;
    870         }
     824        LPNMHDR lpnmh = (LPNMHDR)lParam;
     825        UINT stringId = -1;
     826
     827        /* set up the button tooltips strings */
     828        if(TTN_GETDISPINFOA == lpnmh->code )
     829        {
     830            LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam;
     831            switch(lpnmh->idFrom )
     832            {
     833                /* Up folder button */
     834                case FCIDM_TB_UPFOLDER:
     835                    stringId = IDS_UPFOLDER;
     836                    break;
     837                /* New folder button */
     838                case FCIDM_TB_NEWFOLDER:
     839                    stringId = IDS_NEWFOLDER;
     840                    break;
     841                /* List option button */
     842                case FCIDM_TB_SMALLICON:
     843                    stringId = IDS_LISTVIEW;
     844                    break;
     845                /* Details option button */
     846                case FCIDM_TB_REPORTVIEW:
     847                    stringId = IDS_REPORTVIEW;
     848                    break;
     849                /* Desktop button */
     850                case FCIDM_TB_DESKTOP:
     851                    stringId = IDS_TODESKTOP;
     852                    break;
     853                default:
     854                    stringId = 0;
     855            }
     856            lpdi->hinst = COMMDLG_hInstance32;
     857            lpdi->lpszText =  (LPSTR) stringId;
     858        }
    871859        return FALSE;
    872860    }
    873 
    874861    default :
    875862      if(uMsg >= CDM_FIRST && uMsg <= CDM_LAST)
     
    888875  LPITEMIDLIST pidlItemId;
    889876  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
    890   DWORD count;
    891 
    892   TRACE("\n");
    893 
    894 #ifndef __WIN32OS2__
    895   /* Make sure the common control DLL is loaded */
    896   InitCommonControls();
    897 #endif
    898 //MessageBox(hwnd,"WM_INITDIALOG",NULL,MB_OK);
    899 dprintf(("CB: FILEDLG95_SHELL_Init"));
    900 count = GetTickCount();
     877
     878  TRACE("dir=%s file=%s\n",
     879  fodInfos->ofnInfos->lpstrInitialDir, fodInfos->ofnInfos->lpstrFile);
     880
     881  /* Get the initial directory pidl */
     882
     883  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->ofnInfos->lpstrInitialDir)))
     884  {
     885    char path[MAX_PATH];
     886
     887    GetCurrentDirectoryA(MAX_PATH,path);
     888    pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
     889
     890  }
     891
    901892  /* Initialise shell objects */
    902893  FILEDLG95_SHELL_Init(hwnd);
    903 //dprintf(("CB: FILEDLG95_InitUI %d ms",GetTickCount()-count));
    904 //count = GetTickCount();
     894
    905895  /* Initialise dialog UI */
    906896  FILEDLG95_InitUI(hwnd);
    907 //dprintf(("CB: FILEDLG95_LOOKIN_Init %d",GetTickCount()-count));
    908 //count = GetTickCount();
     897
    909898  /* Initialize the Look In combo box*/
    910899  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
    911 //dprintf(("CB: FILEDLG95_FILETYPE_Init %d",GetTickCount()-count));
    912 //count = GetTickCount();
     900
    913901  /* Initialize the filter combo box */
    914902  FILEDLG95_FILETYPE_Init(hwnd);
    915 //dprintf(("CB: FILEDLG95_FILETYPE_Init done %d",GetTickCount()-count));
    916 //count = GetTickCount();
    917   /* Get the initial directory pidl */
    918 
    919   if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->ofnInfos->lpstrInitialDir)))
    920   {
    921     char path[MAX_PATH];
    922 
    923     GetCurrentDirectoryA(MAX_PATH,path);
    924     pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
    925                      path);
    926 
    927   }
    928 dprintf(("CB: IShellBrowser_BrowseObject %d",GetTickCount()-count));
    929 count = GetTickCount();
    930 //CB: slowest part
     903
    931904  /* Browse to the initial directory */
    932   IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId,SBSP_RELATIVE);
    933 dprintf(("CB: done WM_INITDIALOG %d",GetTickCount()-count));
     905  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE);
     906
    934907  /* Free pidlItem memory */
    935908  COMDLG32_SHFree(pidlItemId);
     
    968941    /* Cancel button */
    969942  case IDCANCEL:
     943      FILEDLG95_Clean(hwnd);
    970944      EndDialog(hwnd, FALSE);
    971945    break;
     
    986960    /* New folder button */
    987961  case FCIDM_TB_NEWFOLDER:
    988     FILEDLG95_SHELL_NewFolder(hwnd);
     962    FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_NEWFOLDER);
    989963    break;
    990964    /* List option button */
     
    996970    FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWDETAILS);
    997971    break;
     972    /* Details option button */
     973  case FCIDM_TB_DESKTOP:
     974    FILEDLG95_SHELL_BrowseToDesktop(hwnd);
     975    break;
    998976
    999977  case IDC_FILENAME:
     
    1003981  /* Do not use the listview selection anymore */
    1004982  fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
    1005   return 0;
     983  return 0; 
    1006984}
    1007985
     
    1020998  SetWindowLongA(hwnd,DWL_MSGRESULT,(LONG)fodInfos->Shell.FOIShellBrowser);
    1021999
    1022   return TRUE;
     1000  return TRUE; 
    10231001}
    10241002
     
    10311009{
    10321010  TBBUTTON tbb[] =
    1033   {{VIEW_PARENTFOLDER, FCIDM_TB_UPFOLDER,   TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     1011  {
     1012   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
     1013   {VIEW_PARENTFOLDER, FCIDM_TB_UPFOLDER,   TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     1014   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
     1015   {VIEW_NEWFOLDER+1,  FCIDM_TB_DESKTOP,    TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    10341016   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
    10351017   {VIEW_NEWFOLDER,    FCIDM_TB_NEWFOLDER,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     
    10381020   {VIEW_DETAILS,      FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    10391021  };
    1040   TBADDBITMAP tba = { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR };
     1022  TBADDBITMAP tba[] =
     1023  {
     1024   { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR },
     1025   { COMDLG32_hInstance, 800 }                  // desktop icon
     1026  };
     1027 
    10411028  RECT rectTB;
    1042 
     1029 
    10431030  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    10441031
     
    10541041  MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
    10551042
    1056   fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL,
     1043  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL, 
    10571044        WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
    10581045        0, 0, 150, 26,
    1059         hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL);
    1060 
    1061   SetWindowPos(fodInfos->DlgInfos.hwndTB, 0,
    1062         rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
    1063         SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
     1046        hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL);
     1047 
     1048  SetWindowPos(fodInfos->DlgInfos.hwndTB, 0, 
     1049        rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
     1050        SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
    10641051
    10651052  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
     
    10671054/* fixme: use TB_LOADIMAGES when implemented */
    10681055/*  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, (WPARAM) IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
    1069   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 12, (LPARAM) &tba);
    1070 
    1071   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 6,(LPARAM) &tbb);
    1072   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
     1056  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 12, (LPARAM) &tba[0]);
     1057  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 1, (LPARAM) &tba[1]);
     1058
     1059  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 9,(LPARAM) &tbb);
     1060  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
    10731061
    10741062  /* Set the window text with the text specified in the OPENFILENAME structure */
     
    10851073  if(fodInfos->ofnInfos->lpstrFile)
    10861074  {
    1087       /**
    1088        * When passed a fully qualified filename, windows removes
    1089        * the path component, before showing it in the control
    1090        */
    1091       LPSTR lpstrFileName = NULL;
    1092 
    1093       lpstrFileName = (LPSTR)COMDLG32_PathFindFilenameA(fodInfos->ofnInfos->lpstrFile);
    1094       if(NULL != lpstrFileName)
    1095           SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileName);
    1096       else
    1097           SetDlgItemTextA(hwnd,IDC_FILENAME,"");
     1075      LPSTR lpstrFile = COMDLG32_PathFindFileNameA(fodInfos->ofnInfos->lpstrFile);
     1076      SetDlgItemTextA(hwnd, IDC_FILENAME, lpstrFile);
    10981077  }
    10991078
     
    11031082    SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_SETCHECK,(WPARAM)TRUE,0);
    11041083  }
     1084
    11051085  /* Must the open as read only check box be hid ?*/
    11061086  if(fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY)
     
    11081088    ShowWindow(GetDlgItem(hwnd,IDC_OPENREADONLY),SW_HIDE);
    11091089  }
     1090
    11101091  /* Must the help button be hid ?*/
    11111092  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
     
    11131094    ShowWindow(GetDlgItem(hwnd, pshHelp), SW_HIDE);
    11141095  }
     1096
    11151097  /* Resize the height, if open as read only checkbox ad help button
    11161098     are hidden */
     
    11241106    /* subtract the height of the help button plus the space between
    11251107       the help button and the cancel button to the height of the dialog */
    1126     SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
    1127                  (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
     1108    SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left, 
     1109                 (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom), 
    11281110                 SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
    11291111  }
    1130   /* change Open to Save */
     1112
     1113  /* change Open to Save FIXME: use resources */
    11311114  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    11321115  {
    1133       SetDlgItemTextA(hwnd,IDOK,"Save");
     1116      SetDlgItemTextA(hwnd,IDOK,"&Save");
    11341117      SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in");
    11351118  }
     
    11391122/***********************************************************************
    11401123 *      FILEDLG95_OnOpenMultipleFiles
    1141  *
     1124 *     
    11421125 * Handles the opening of multiple files.
    11431126 *
     1127 * FIXME
     1128 *  check destination buffer size
     1129 */
     1130BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
     1131{
     1132  CHAR   lpstrPathSpec[MAX_PATH] = "";
     1133  LPSTR  lpstrFile;
     1134  UINT   nCount, nSizePath;
     1135  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     1136
     1137  TRACE("\n");
     1138
     1139  lpstrFile = fodInfos->ofnInfos->lpstrFile;
     1140  lpstrFile[0] = '\0';
     1141 
     1142  COMDLG32_SHGetPathFromIDListA( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
     1143
     1144  if ( !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
     1145      ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
     1146  {
     1147    LPSTR lpstrTemp = lpstrFileList;
     1148
     1149    for ( nCount = 0; nCount < nFileCount; nCount++ )
     1150    {
     1151      LPITEMIDLIST pidl;
     1152
     1153      pidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrTemp);
     1154      if (!pidl)
     1155      {
     1156        CHAR lpstrNotFound[100];
     1157        CHAR lpstrMsg[100];
     1158        CHAR tmp[400];
     1159
     1160        LoadStringA(COMMDLG_hInstance32, IDS_FILENOTFOUND, lpstrNotFound, 100);
     1161        LoadStringA(COMMDLG_hInstance32, IDS_VERIFYFILE, lpstrMsg, 100);
     1162
     1163        strcpy(tmp, lpstrTemp);
     1164        strcat(tmp, "\n");
     1165        strcat(tmp, lpstrNotFound);
     1166        strcat(tmp, "\n");
     1167        strcat(tmp, lpstrMsg);
     1168
     1169        MessageBoxA(hwnd, tmp, fodInfos->ofnInfos->lpstrTitle, MB_OK | MB_ICONEXCLAMATION);
     1170        return FALSE;
     1171      }
     1172 
     1173      lpstrTemp += strlen(lpstrFileList) + 1;
     1174      COMDLG32_SHFree(pidl);
     1175    }
     1176  }
     1177
     1178  nSizePath = strlen(lpstrPathSpec);
     1179  strcpy( lpstrFile, lpstrPathSpec);
     1180  memcpy( lpstrFile + nSizePath + 1, lpstrFileList, sizeUsed );
     1181
     1182  fodInfos->ofnInfos->nFileOffset = nSizePath + 1;
     1183  fodInfos->ofnInfos->nFileExtension = 0;
     1184
     1185  /* clean and exit */
     1186  FILEDLG95_Clean(hwnd);
     1187  return EndDialog(hwnd,TRUE);
     1188}
     1189
     1190/***********************************************************************
     1191 *      FILEDLG95_OnOpen
     1192 *
     1193 * Ok button WM_COMMAND message handler
     1194 *
     1195 * If the function succeeds, the return value is nonzero.
     1196 */
     1197#define ONOPEN_BROWSE 1
     1198#define ONOPEN_OPEN   2
     1199#define ONOPEN_SEARCH 3
     1200static void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText)
     1201{
     1202  char strMsgTitle[MAX_PATH];
     1203  char strMsgText [MAX_PATH];
     1204  if (idCaption)
     1205    LoadStringA(COMDLG32_hInstance, idCaption, strMsgTitle, sizeof(strMsgTitle));
     1206  else
     1207    strMsgTitle[0] = '\0';
     1208  LoadStringA(COMDLG32_hInstance, idText, strMsgText, sizeof(strMsgText));
     1209  MessageBoxA(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND);
     1210}
     1211
     1212BOOL FILEDLG95_OnOpen(HWND hwnd)
     1213{
     1214  char * lpstrFileList;
     1215  UINT nFileCount = 0;
     1216  UINT sizeUsed = 0;
     1217  BOOL ret = TRUE;
     1218  char lpstrPathAndFile[MAX_PATH];
     1219  char lpstrTemp[MAX_PATH];
     1220  LPSHELLFOLDER lpsf = NULL;
     1221  int nOpenAction;
     1222  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     1223
     1224  TRACE("hwnd=0x%04x\n", hwnd);
     1225
     1226  /* get the files from the edit control */
     1227  nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed);
     1228
     1229  /* try if the user selected a folder in the shellview */
     1230  if(nFileCount == 0)
     1231  {
     1232      BrowseSelectedFolder(hwnd);
     1233      return FALSE;
     1234  }
     1235 
     1236  if(nFileCount > 1)
     1237  {
     1238      ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
     1239      goto ret;
     1240  }
     1241
     1242  TRACE("count=%u len=%u file=%s\n", nFileCount, sizeUsed, lpstrFileList);
     1243
     1244/*
     1245  Step 1:  Build a complete path name from the current folder and
     1246  the filename or path in the edit box.
     1247  Special cases:
     1248  - the path in the edit box is a root path
     1249    (with or without drive letter)
     1250  - the edit box contains ".." (or a path with ".." in it)
    11441251*/
    1145 BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
    1146 {
    1147   CHAR   lpstrPathSpec[MAX_PATH] = "";
    1148   CHAR   lpstrTempFileList[MAX_PATH] = "";
    1149   LPSTR  lpstrFile;
    1150   UINT   sizePath;
    1151   UINT   nCount;
    1152   FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    1153 
    1154   TRACE("\n");
    1155 
    1156   lpstrFile = fodInfos->ofnInfos->lpstrFile;
    1157 
    1158   COMDLG32_SHGetPathFromIDListA( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
    1159   sizePath = lstrlenA( lpstrPathSpec );
    1160 
    1161   memset( lpstrFile, 0x0, fodInfos->ofnInfos->nMaxFile * sizeof(CHAR) );
    1162 
    1163   if ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST ||
    1164           !(fodInfos->ofnInfos->Flags & OFN_EXPLORER ))
    1165   {
    1166       LPSTR lpstrTemp = lpstrFileList;
    1167 
    1168       for ( nCount = 0; nCount < nFileCount; nCount++ )
     1252
     1253  /* Get the current directory name */
     1254  if (!COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathAndFile))
     1255  {
     1256    /* we are in a special folder, default to desktop */
     1257    if(FAILED(COMDLG32_SHGetFolderPathA(hwnd, CSIDL_DESKTOPDIRECTORY|CSIDL_FLAG_CREATE, NULL, 0, lpstrPathAndFile)))
     1258    {
     1259      /* last fallback */
     1260      GetCurrentDirectoryA(MAX_PATH, lpstrPathAndFile);
     1261    }
     1262  }
     1263  COMDLG32_PathAddBackslashA(lpstrPathAndFile);
     1264
     1265  TRACE("current directory=%s\n", lpstrPathAndFile);
     1266
     1267  /* if the user specifyed a fully qualified path use it */
     1268  if(COMDLG32_PathIsRelativeA(lpstrFileList))
     1269  {
     1270    strcat(lpstrPathAndFile, lpstrFileList);
     1271  }
     1272  else
     1273  {
     1274    /* does the path have a drive letter? */
     1275    if (COMDLG32_PathGetDriveNumberA(lpstrFileList) == -1)
     1276      strcpy(lpstrPathAndFile+2, lpstrFileList);
     1277    else
     1278      strcpy(lpstrPathAndFile, lpstrFileList);
     1279  }
     1280
     1281  /* resolve "." and ".." */
     1282  COMDLG32_PathCanonicalizeA(lpstrTemp, lpstrPathAndFile );
     1283  strcpy(lpstrPathAndFile, lpstrTemp);
     1284  TRACE("canon=%s\n", lpstrPathAndFile);
     1285
     1286  MemFree(lpstrFileList);
     1287
     1288/*
     1289  Step 2: here we have a cleaned up path
     1290
     1291  We have to parse the path step by step to see if we have to browse
     1292  to a folder if the path points to a directory or the last
     1293  valid element is a directory.
     1294 
     1295  valid variables:
     1296    lpstrPathAndFile: cleaned up path
     1297 */
     1298
     1299  nOpenAction = ONOPEN_BROWSE;
     1300
     1301  /* dont apply any checks with OFN_NOVALIDATE */
     1302  if(!(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE))
     1303  {
     1304    LPSTR lpszTemp, lpszTemp1;
     1305    LPITEMIDLIST pidl = NULL;
     1306
     1307    /* check for invalid chars */
     1308    if(strpbrk(lpstrPathAndFile+3, "/:<>|") != NULL)
     1309    {
     1310      FILEDLG95_OnOpenMessage(hwnd, IDS_INVALID_FILENAME_TITLE, IDS_INVALID_FILENAME);
     1311      ret = FALSE;
     1312      goto ret;
     1313    }
     1314
     1315    if (FAILED (COMDLG32_SHGetDesktopFolder(&lpsf))) return FALSE;
     1316 
     1317    lpszTemp1 = lpszTemp = lpstrPathAndFile;
     1318    while (lpszTemp1)
     1319    {
     1320      LPSHELLFOLDER lpsfChild;
     1321      WCHAR lpwstrTemp[MAX_PATH];
     1322      DWORD dwEaten, dwAttributes;
     1323
     1324      lpszTemp = COMDLG32_PathFindNextComponentA(lpszTemp);
     1325      if (*lpszTemp)
     1326        lstrcpynAtoW(lpwstrTemp, lpszTemp1, lpszTemp - lpszTemp1);
     1327      else
    11691328      {
    1170           WIN32_FIND_DATAA findData;
    1171           CHAR lpstrFindFile[MAX_PATH];
    1172           HANDLE hFind;
    1173 
    1174           memset( lpstrFindFile, 0x0, MAX_PATH * sizeof(CHAR) );
    1175 
    1176           lstrcpyA( lpstrFindFile, lpstrPathSpec );
    1177           lstrcatA( lpstrFindFile, "\\" );
    1178           lstrcatA( lpstrFindFile, lpstrTemp );
    1179 
    1180           hFind = FindFirstFileA( lpstrFindFile, &findData );
    1181           if (hFind == INVALID_HANDLE_VALUE)
    1182           {
    1183               CHAR lpstrNotFound[100];
    1184               CHAR lpstrMsg[100];
    1185               CHAR tmp[400];
    1186 
    1187               LoadStringA(COMMDLG_hInstance32, IDS_FILENOTFOUND, lpstrNotFound, 100);
    1188               LoadStringA(COMMDLG_hInstance32, IDS_VERIFYFILE, lpstrMsg, 100);
    1189 
    1190               strcpy(tmp, lpstrFindFile);
    1191               strcat(tmp, "\n");
    1192               strcat(tmp, lpstrNotFound);
    1193               strcat(tmp, "\n");
    1194               strcat(tmp, lpstrMsg);
    1195 
    1196               MessageBoxA(hwnd,
    1197                       tmp,
    1198                       fodInfos->ofnInfos->lpstrTitle,
    1199                       MB_OK | MB_ICONEXCLAMATION);
    1200               return FALSE;
    1201           } else FindClose(hFind);
    1202 
    1203           if (!(fodInfos->ofnInfos->Flags & OFN_EXPLORER ))
    1204           {
    1205               lstrcatA( lpstrTempFileList, findData.cAlternateFileName);
    1206               if ( nCount + 1 < nFileCount)
    1207                   lstrcatA( lpstrTempFileList, " ");
    1208           }
    1209           lpstrTemp += strlen(lpstrFileList) + 1;
     1329        lstrcpyAtoW(lpwstrTemp, lpszTemp1);     /* last element */
     1330        if(strpbrk(lpszTemp1, "*?") != NULL)
     1331        {
     1332          nOpenAction = ONOPEN_SEARCH;
     1333          break;
    12101334        }
    12111335      }
    1212 
    1213       if ( fodInfos->ofnInfos->Flags & OFN_EXPLORER )
     1336      lpszTemp1 = lpszTemp;
     1337
     1338      TRACE("parse now=%s next=%s sf=%p\n",debugstr_w(lpwstrTemp), debugstr_a(lpszTemp), lpsf);
     1339
     1340      if(lstrlenW(lpwstrTemp)==2) COMDLG32_PathAddBackslashW(lpwstrTemp);
     1341
     1342      dwAttributes = SFGAO_FOLDER;
     1343      if(FAILED(IShellFolder_ParseDisplayName(lpsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes)))
    12141344      {
    1215         lstrcpyA( lpstrFile, lpstrPathSpec);
    1216         memcpy( lpstrFile + sizePath + 1, lpstrFileList, sizeof(CHAR) * sizeUsed );
     1345        if(*lpszTemp)   /* points to trailing null for last path element */
     1346        {
     1347          if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST)
     1348          {
     1349            FILEDLG95_OnOpenMessage(hwnd, 0, IDS_PATHNOTEXISTING);
     1350            break;
     1351          }
     1352        }
     1353        else
     1354        {
     1355          if(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST)
     1356          {
     1357            FILEDLG95_OnOpenMessage(hwnd, 0, IDS_FILENOTEXISTING);
     1358            break;
     1359          }
     1360        }
     1361        /* change to the current folder */
     1362        nOpenAction = ONOPEN_OPEN;
     1363        break;
    12171364      }
    12181365      else
    12191366      {
    1220         memcpy( lpstrFile, lpstrTempFileList, sizeof(CHAR) * strlen(lpstrTempFileList));
     1367        /* the path component is valid */
     1368        TRACE("parse OK attr=0x%08lx pidl=%p\n", dwAttributes, pidl);
     1369        if(dwAttributes & SFGAO_FOLDER)
     1370        {
     1371          if(FAILED(IShellFolder_BindToObject(lpsf, pidl, 0, &IID_IShellFolder, (LPVOID*)&lpsfChild)))
     1372          {
     1373            ERR("bind to failed\n"); /* should not fail */
     1374            break;
     1375          }
     1376          IShellFolder_Release(lpsf);
     1377          lpsf = lpsfChild;
     1378          lpsfChild = NULL;
     1379        }
     1380        else
     1381        {
     1382          TRACE("value\n");
     1383
     1384          /* end dialog, return value */
     1385          nOpenAction = ONOPEN_OPEN;
     1386          break;
     1387        }
     1388        COMDLG32_SHFree(pidl);
     1389        pidl = NULL;
    12211390      }
    1222 
    1223       fodInfos->ofnInfos->nFileOffset = sizePath + 1;
    1224       fodInfos->ofnInfos->nFileExtension = 0;
    1225 
    1226   /* clean and exit */
    1227   return EndDialog(hwnd,TRUE);
    1228 }
    1229 
    1230 /***********************************************************************
    1231  *      FILEDLG95_OnOpen
    1232  *
    1233  * Ok button WM_COMMAND message handler
    1234  *
    1235  * If the function succeeds, the return value is nonzero.
    1236  */
    1237 BOOL FILEDLG95_OnOpen(HWND hwnd)
    1238 {
    1239   CHAR lpstrSpecifiedByUser[MAX_PATH] = "";
    1240   CHAR lpstrFileList[MAX_PATH] = "";
    1241   LPSTR lpstrFile;
    1242   UINT nStrCharCount = 0;
    1243   UINT nFileCount = 0;
    1244   UINT nFileIndex = 0;
    1245   UINT sizeUsed = 0;
    1246   UINT nStrLen = 0;
    1247 
    1248   FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    1249 
    1250   TRACE("\n");
    1251 
    1252   /* If a folder is selected browse folder */
    1253   if (BrowseSelectedFolder(hwnd))
    1254       return FALSE;
    1255 
    1256   lpstrFile = fodInfos->ofnInfos->lpstrFile;
    1257 
    1258   GetDlgItemTextA(hwnd, IDC_FILENAME, lpstrSpecifiedByUser, MAX_PATH);
    1259   nStrLen = strlen(lpstrSpecifiedByUser);
    1260 
    1261   while ( nStrCharCount <= nStrLen )
    1262   {
    1263       if ( lpstrSpecifiedByUser[nStrCharCount]=='"' )
    1264       {
    1265           nStrCharCount++;
    1266 
    1267           while ((lpstrSpecifiedByUser[nStrCharCount]!='"') &&
    1268               (nStrCharCount <= nStrLen))
    1269           {
    1270               lpstrFileList[nFileIndex++] = lpstrSpecifiedByUser[nStrCharCount];
    1271               nStrCharCount++;
    1272               sizeUsed++;
    1273           }
    1274           lpstrFileList[nFileIndex++] = '\0';
    1275           sizeUsed++;
    1276           nFileCount++;
    1277       }
    1278       nStrCharCount++;
    1279   }
    1280 
    1281   if(nFileCount > 0)
    1282       return FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
    1283 
    1284   if (nStrLen)
    1285   {
    1286       LPSHELLFOLDER psfDesktop;
    1287       LPITEMIDLIST browsePidl;
    1288       LPSTR lpstrFileSpec;
    1289       LPSTR lpstrTemp;
    1290       char lpstrPathSpec[MAX_PATH] = "";
    1291       char lpstrCurrentDir[MAX_PATH] = "";
    1292       char lpstrPathAndFile[MAX_PATH] = "";
    1293 
    1294       /* Separate the file spec from the path spec
    1295          e.g.:
    1296               lpstrSpecifiedByUser  lpstrPathSpec  lpstrFileSpec
    1297               C:\TEXT1\TEXT2        C:\TEXT1          TEXT2
    1298       */
    1299       if (nFileCount == 0)
    1300       {
    1301         lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser);
    1302         strcpy(lpstrPathSpec,lpstrSpecifiedByUser);
    1303         COMDLG32_PathRemoveFileSpecA(lpstrPathSpec);
    1304       }
    1305 
    1306       /* Get the index of the selected item in the filetype combo box */
    1307       fodInfos->ofnInfos->nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    1308       /* nFilterIndex is 1 based while combo GetCurSel return zero based index */
    1309       fodInfos->ofnInfos->nFilterIndex++;
    1310 
    1311       /* Get the current directory name */
    1312       COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
    1313                                     lpstrCurrentDir);
    1314 
    1315       /* Create an absolute path name */
    1316       if(lpstrSpecifiedByUser[1] != ':')
    1317       {
    1318           switch(lpstrSpecifiedByUser[0])
    1319           {
    1320           /* Add drive spec  \TEXT => C:\TEXT */
    1321           case '\\':
    1322               {
    1323                   INT iCopy = 2;
    1324                   char lpstrTmp[MAX_PATH] = "";
    1325                   if(!strlen(lpstrPathSpec))
    1326                       iCopy = 3;
    1327                   strncpy(lpstrTmp,lpstrCurrentDir,iCopy);
    1328                   strcat(lpstrTmp,lpstrPathSpec);
    1329                   strcpy(lpstrPathSpec,lpstrTmp);
    1330               }
    1331               break;
    1332           /* Go to parent ..\TEXT */
    1333           case '.':
    1334               {
    1335                   INT iSize;
    1336                   char lpstrTmp2[MAX_PATH] = "";
    1337                   LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\');
    1338                   iSize = lpstrTmp - lpstrCurrentDir;
    1339                   strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1);
    1340                   if(strlen(lpstrSpecifiedByUser) <= 3)
    1341                       strcpy(lpstrFileSpec,"");
    1342                   if(strcmp(lpstrPathSpec,".."))
    1343                       strcat(lpstrTmp2,&lpstrPathSpec[3]);
    1344                   strcpy(lpstrPathSpec,lpstrTmp2);
    1345               }
    1346               break;
    1347           default:
    1348               {
    1349                   char lpstrTmp[MAX_PATH] = "";
    1350                   if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\"))
    1351                       strcat(lpstrCurrentDir,"\\");
    1352                   strcpy(lpstrTmp,lpstrCurrentDir);
    1353                   strcat(lpstrTmp,lpstrPathSpec);
    1354                   strcpy(lpstrPathSpec,lpstrTmp);
    1355               }
    1356 
    1357           } /* end switch */
    1358       }
    1359 
    1360       if(strlen(lpstrPathSpec))
    1361       {
    1362           /* Browse to the right directory */
    1363           COMDLG32_SHGetDesktopFolder(&psfDesktop);
    1364           browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec);
    1365           if(browsePidl)
    1366           {
    1367               /* Browse to directory */
    1368               IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
    1369                                          browsePidl,
    1370                                          SBSP_ABSOLUTE);
    1371               COMDLG32_SHFree(browsePidl);
    1372           }
    1373           else
    1374           {
    1375               /* Path does not exist */
    1376               if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST)
    1377               {
    1378                   MessageBoxA(hwnd,
    1379                               "Path does not exist",
    1380                               fodInfos->ofnInfos->lpstrTitle,
    1381                               MB_OK | MB_ICONEXCLAMATION);
    1382                   return FALSE;
    1383               }
    1384           }
    1385 
    1386           strcat(lpstrPathAndFile,lpstrPathSpec);
    1387           IShellFolder_Release(psfDesktop);
    1388       }
    1389       else
    1390       {
    1391           strcat(lpstrPathAndFile,lpstrCurrentDir);
    1392       }
    1393 
    1394       /* Create the path and file string */
    1395       COMDLG32_PathAddBackslashA(lpstrPathAndFile);
    1396       strcat(lpstrPathAndFile,lpstrFileSpec);
    1397 
    1398       /* Update the edit field */
    1399       SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec);
    1400       SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1);
    1401 
    1402       /* Don't go further if we dont have a file spec */
    1403       if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec))
    1404           return FALSE;
    1405 
    1406       /* Time to check lpstrFileSpec         */
    1407       /* search => contains * or ?           */
    1408       /* browse => contains a directory name */
    1409       /* file   => contains a file name      */
    1410 
    1411       /* Check if this is a search */
    1412       if(strchr(lpstrFileSpec,'*') || strchr(lpstrFileSpec,'?'))
     1391    }
     1392    if(pidl) COMDLG32_SHFree(pidl);
     1393  }
     1394
     1395  /* path is valid, clean the edit box */
     1396  SetDlgItemTextA(hwnd,IDC_FILENAME,"");
     1397
     1398/*
     1399  Step 3: here we have a cleaned up and validated path
     1400
     1401  valid variables:
     1402   lpsf:             ShellFolder bound to the rightmost valid path component
     1403   lpstrPathAndFile: cleaned up path
     1404   nOpenAction:      action to do
     1405*/
     1406  TRACE("end validate sf=%p\n", lpsf);
     1407
     1408  switch(nOpenAction)
     1409  {
     1410    case ONOPEN_SEARCH:   /* set the current filter to the file mask and refresh */
     1411      TRACE("ONOPEN_SEARCH %s\n", lpstrPathAndFile);
    14131412      {
    14141413        int iPos;
    1415 
    1416         /* Set the current filter with the current selection */
     1414        LPSTR lpszTemp = COMDLG32_PathFindFileNameA(lpstrPathAndFile);
     1415
     1416        /* replace the current filter */
    14171417        if(fodInfos->ShellInfos.lpstrCurrentFilter)
    1418           MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
    1419 
    1420         fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpstrFileSpec)+1)*2);
    1421         lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,
    1422                     (LPSTR)strlwr((LPSTR)lpstrFileSpec));
    1423 
    1424         IShellView_Refresh(fodInfos->Shell.FOIShellView);
    1425 
    1426         if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,
    1427                                                      lpstrFileSpec)))
    1428         CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,iPos);
    1429 
    1430         return FALSE;
     1418          MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
     1419        fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpszTemp)+1)*sizeof(WCHAR));
     1420        lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
     1421
     1422        /* set the filter cb to the extension when possible */
     1423        if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
     1424        CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, iPos);
    14311425      }
    1432 
     1426      /* fall through */
     1427    case ONOPEN_BROWSE:   /* browse to the highest folder we could bind to */
     1428      TRACE("ONOPEN_BROWSE\n");
    14331429      {
    1434         HANDLE hFile;
    1435         WIN32_FIND_DATAA stffile;
    1436 
    1437         /* browse if the user specified a directory */
    1438         hFile = FindFirstFileA(lpstrPathAndFile,&stffile);
    1439         if ( hFile != INVALID_HANDLE_VALUE )
     1430        IPersistFolder2 * ppf2;
     1431        if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
    14401432        {
    1441           FindClose (hFile);
    1442           if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    1443            browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
    1444                                         lpstrFileSpec);
    1445           else
    1446           {
    1447             // if there is an extention, then get the Pidl otherwise
    1448             // we are going to need to add the extention
    1449             if(strrchr(lpstrFileSpec,'.'))
    1450               browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
    1451                                           lpstrFileSpec);
    1452             else
    1453               browsePidl=NULL;
    1454           }
    1455         }
    1456         else
    1457           browsePidl=NULL;
    1458       }
    1459 
    1460       if (!browsePidl) /* not a directory check the specified file exists */
    1461       {
    1462         int i;
    1463         int iExt;
    1464         char lpstrFileSpecTemp[MAX_PATH] = "";
    1465         LPSTR lpstrExt;
    1466         LPSTR lpOrg;
    1467         LPSTR lpBuf;
    1468 
    1469         iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    1470         lpOrg = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, iExt);
    1471         if (lpOrg == (LPSTR)-1)
    1472           lpOrg = NULL;     // we get -1 if the filetype LB is empty
    1473 
    1474         lpstrExt = lpOrg;
    1475 
    1476         /*
    1477          Simply take the first one of the list as default.
    1478          Otherwise the user must specify which extention they want.
    1479          Also, make sure we don't have a .*, in this case simply
    1480          forget about the extention
    1481         */
    1482         lpstrExt = strchr(lpOrg, ';');
    1483         if (lpstrExt)
    1484         {
    1485           i = lpstrExt - lpOrg;
    1486         }
    1487         else
    1488           i = strlen(lpOrg);
    1489         lpBuf = MemAlloc(i+1);
    1490         strncpy(lpBuf, lpOrg, i);
    1491         lpBuf[i] = 0;
    1492         strcpy(lpstrFileSpecTemp, lpstrFileSpec);
    1493 
    1494         if (lpstrFileSpecTemp[strlen(lpstrFileSpecTemp)-1] == '.')
    1495         {
    1496           if (strchr(lpBuf, '.'))
    1497             strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1);
    1498         }
    1499         else
    1500           strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
    1501 
    1502         browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
    1503                                      lpstrFileSpecTemp);
    1504         MemFree((void *)lpBuf);
    1505         if (browsePidl)
    1506           strcpy(lpstrFileSpec,lpstrFileSpecTemp);
    1507         if (lpstrExt)
    1508           lpOrg = lpstrExt+1;
    1509         else
    1510           lpOrg = NULL;
    1511       }
    1512 
    1513       if (browsePidl)
    1514       {
    1515           ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    1516           int    nMsgBoxRet;
    1517           char   lpstrFileExist[MAX_PATH + 50];
    1518 
    1519           IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder,
    1520                                        1,
    1521                                        &browsePidl,
    1522                                        &ulAttr);
    1523 
    1524           /* Browse to directory if it is a folder */
    1525           if (ulAttr & SFGAO_FOLDER)
    1526           {
    1527               if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
    1528                                                    browsePidl,
    1529                                                    SBSP_RELATIVE)))
    1530               {
    1531                   if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST)
    1532                   {
    1533                       MessageBoxA(hwnd,
    1534                                   "Path does not exist",
    1535                                   fodInfos->ofnInfos->lpstrTitle,
    1536                                   MB_OK | MB_ICONEXCLAMATION);
    1537                       COMDLG32_SHFree(browsePidl);
    1538                       return FALSE;
    1539                   }
    1540               }
    1541               COMDLG32_SHFree(browsePidl);
    1542               return FALSE;
    1543           }
    1544 
    1545           /* The file does exist, so ask the user if we should overwrite it */
    1546           if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) &&
    1547              (fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT))
    1548           {
    1549                 strcpy(lpstrFileExist, lpstrFileSpec);
    1550                 strcat(lpstrFileExist, " already exists.\nDo you want to replace it?");
    1551 
    1552                 nMsgBoxRet = MessageBoxA(hwnd,
    1553                                         lpstrFileExist,
    1554                                         fodInfos->ofnInfos->lpstrTitle,
    1555                                         MB_YESNO | MB_ICONEXCLAMATION);
    1556                 if (nMsgBoxRet == IDNO)
    1557                 {
    1558                     COMDLG32_SHFree(browsePidl);
    1559                     return FALSE;
    1560                 }
    1561           }
    1562           COMDLG32_SHFree(browsePidl);
    1563       }
    1564       else
    1565       {
    1566         /* File does not exist in current directory */
    1567 
    1568         /* The selected file does not exist */
    1569         /* Tell the user the selected does not exist */
    1570         if(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST)
    1571         {
    1572           char lpstrNotFound[100];
    1573           char lpstrMsg[100];
    1574           char tmp[400];
    1575 
    1576           LoadStringA(COMMDLG_hInstance32,
    1577                       IDS_FILENOTFOUND,
    1578                       lpstrNotFound,
    1579                       100);
    1580           LoadStringA(COMMDLG_hInstance32,
    1581                       IDS_VERIFYFILE,
    1582                       lpstrMsg,
    1583                       100);
    1584 
    1585           strcpy(tmp,fodInfos->ofnInfos->lpstrFile);
    1586           strcat(tmp,"\n");
    1587           strcat(tmp,lpstrNotFound);
    1588           strcat(tmp,"\n");
    1589           strcat(tmp,lpstrMsg);
    1590 
    1591           MessageBoxA(hwnd,
    1592                       tmp,
    1593                       fodInfos->ofnInfos->lpstrTitle,
    1594                       MB_OK | MB_ICONEXCLAMATION);
    1595           return FALSE;
    1596         }
    1597         /* Ask the user if he wants to create the file*/
    1598         if(fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT)
    1599         {
    1600           char tmp[100];
    1601 
    1602           LoadStringA(COMMDLG_hInstance32,IDS_CREATEFILE,tmp,100);
    1603 
    1604           if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos->lpstrTitle,
    1605                                   MB_YESNO | MB_ICONQUESTION))
    1606           {
    1607             /* Create the file, clean and exit */
    1608             return EndDialog(hwnd,TRUE);
    1609           }
    1610           return FALSE;
     1433          LPITEMIDLIST pidlCurrent;
     1434          IPersistFolder2_GetCurFolder(ppf2, &pidlCurrent);
     1435          IPersistFolder2_Release(ppf2);
     1436          if( ! COMDLG32_PIDL_ILIsEqual(pidlCurrent, fodInfos->ShellInfos.pidlAbsCurrent))
     1437          {
     1438            IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE);
     1439          }
     1440          else if( nOpenAction == ONOPEN_SEARCH )
     1441          {
     1442            IShellView_Refresh(fodInfos->Shell.FOIShellView);
     1443          }
     1444          COMDLG32_SHFree(pidlCurrent);
    16111445        }
    16121446      }
    1613       /* check the write access to the current directory before opening the selected file */
    1614       if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && (fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST))
     1447      ret = FALSE;
     1448      break;
     1449    case ONOPEN_OPEN:   /* fill in the return struct and close the dialog */
     1450      TRACE("ONOPEN_OPEN %s\n", lpstrPathAndFile);
    16151451      {
    1616           HANDLE hfile;
    1617           char testFile[MAX_PATH];
    1618 //CB: I don't like this, what if this file already exists?
    1619           strcpy(testFile,lpstrPathSpec);
    1620           strcat(testFile,"_tes_13.579");
    1621 
    1622           hfile = CreateFileA(testFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
    1623 
    1624           switch(GetLastError())
    1625           {
    1626           case ERROR_ACCESS_DENIED:
    1627           case ERROR_WRITE_PROTECT:
    1628           case ERROR_PATH_NOT_FOUND:
    1629           case ERROR_FILE_NOT_FOUND:
    1630               {
    1631                   char strAccessDenied[MAX_PATH + 100];
    1632                   strcpy(strAccessDenied,lpstrPathSpec);
    1633                   strcat(strAccessDenied,lpstrFileSpec);
    1634                   strcat(strAccessDenied,"\nWrite access denied for this file !");
    1635                   MessageBoxA(hwnd,strAccessDenied,fodInfos->ofnInfos->lpstrTitle,MB_OK | MB_ICONEXCLAMATION);
    1636                   return FALSE;
    1637               }
    1638           }
    1639 
    1640           if (hfile != INVALID_HANDLE_VALUE)
    1641           {
    1642               CloseHandle(hfile);
    1643               DeleteFileA(testFile);
    1644           }
    1645 
     1452        /* add default extension */
     1453        if (fodInfos->ofnInfos->lpstrDefExt)
     1454        {
     1455          if (! *COMDLG32_PathFindExtensionA(lpstrPathAndFile))
     1456          {
     1457            strcat(lpstrPathAndFile, ".");
     1458            strcat(lpstrPathAndFile, fodInfos->ofnInfos->lpstrDefExt);
     1459          }
     1460        }
     1461
     1462        /* Check that size size of the file does not exceed buffer size */
     1463        if(strlen(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile)
     1464        {
     1465          LPSTR lpszTemp;
     1466         
     1467          /* fill destination buffer */
     1468          strcpy(fodInfos->ofnInfos->lpstrFile, lpstrPathAndFile);
     1469
     1470          /* set filename offset */
     1471          lpszTemp = COMDLG32_PathFindFileNameA(lpstrPathAndFile);
     1472          fodInfos->ofnInfos->nFileOffset = lpszTemp - lpstrPathAndFile;
     1473 
     1474          /* set extension offset */
     1475          lpszTemp = COMDLG32_PathFindExtensionA(lpstrPathAndFile);
     1476          fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? lpszTemp - lpstrPathAndFile + 1 : 0;
     1477   
     1478          /* set the lpstrFileTitle */
     1479          if(fodInfos->ofnInfos->lpstrFileTitle)
     1480          {
     1481            LPSTR lpstrFileTitle = COMDLG32_PathFindFileNameA(lpstrPathAndFile);
     1482            strncpy(fodInfos->ofnInfos->lpstrFileTitle, lpstrFileTitle, fodInfos->ofnInfos->nMaxFileTitle);
     1483          }
     1484
     1485          FILEDLG95_Clean(hwnd);
     1486          ret = EndDialog(hwnd, TRUE);
     1487        }
     1488        else
     1489        {
     1490          /* FIXME set error FNERR_BUFFERTOSMALL */
     1491          FILEDLG95_Clean(hwnd);
     1492          ret = EndDialog(hwnd, FALSE);
     1493        }
     1494        goto ret;
    16461495      }
    1647 
    1648       /* Open the selected file */
    1649 
    1650       /* Check file extension */
    1651       if(!strrchr(lpstrPathAndFile,'.'))
    1652       {
    1653           /* if the file has no extension, append the selected
    1654              extension of the filetype combo box */
    1655           int iExt;
    1656           LPSTR lpstrExt;
    1657           iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    1658           lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt);
    1659 
    1660           if((LPSTR)-1 != lpstrTemp)
    1661           {
    1662               lpstrExt = strchr(lpstrTemp,';');
    1663               if(lpstrExt)
    1664               {
    1665                   int i = lpstrExt - lpstrTemp;
    1666                   lpstrExt = MemAlloc(i);
    1667                   strncpy(lpstrExt,&lpstrTemp[1],i-1);
    1668               }
    1669               else
    1670               {
    1671                   lpstrExt = MemAlloc(strlen(lpstrTemp));
    1672                   strcpy(lpstrExt,&lpstrTemp[1]);
    1673               }
    1674 
    1675                if(strcmp(lpstrExt,".*") != 0)
    1676                {
    1677                   /* OPEN DIALOG: Let's see if the file exists with the current extention,
    1678                      if not return the file without the extention.
    1679                      SAVE DIALOG: Concatenate the extention to the file.
    1680                   */
    1681 
    1682                   if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG))
    1683                   {
    1684                         LPSTR lpstrFindFile;
    1685                         WIN32_FIND_DATAA fd;
    1686                         HANDLE hFind;
    1687 
    1688                         lpstrFindFile = MemAlloc(strlen(lpstrPathAndFile)+strlen(lpstrExt));
    1689                         strcpy(lpstrFindFile, lpstrPathAndFile);
    1690                         strcat(lpstrFindFile, lpstrExt);
    1691                         hFind = FindFirstFileA(lpstrFindFile,&fd);
    1692                         if(hFind != INVALID_HANDLE_VALUE)
    1693                         {
    1694                           strcat(lpstrPathAndFile,lpstrExt);
    1695                           FindClose(hFind);
    1696                         }
    1697                         MemFree(lpstrFindFile);
    1698                   }
    1699                   else
    1700                         strcat(lpstrPathAndFile,lpstrExt);
    1701               }
    1702               MemFree( lpstrExt );
    1703           }
    1704       }
    1705       /* Check that size size of the file does not exceed buffer size */
    1706       if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos->nMaxFile)
    1707       {
    1708           /* set error FNERR_BUFFERTOSMALL */
    1709           return EndDialog(hwnd,FALSE);
    1710       }
    1711       strcpy(fodInfos->ofnInfos->lpstrFile,lpstrPathAndFile);
    1712          fodInfos->ofnInfos->lpstrFile[strlen(lpstrPathAndFile)] = '\0';
    1713          fodInfos->ofnInfos->lpstrFile[strlen(lpstrPathAndFile)+1] = '\0';
    1714 
    1715       /* Set the lpstrFileTitle of the OPENFILENAME structure */
    1716       if(fodInfos->ofnInfos->lpstrFileTitle)
    1717           strncpy(fodInfos->ofnInfos->lpstrFileTitle,
    1718                   lpstrFileSpec,
    1719                   fodInfos->ofnInfos->nMaxFileTitle);
    1720 
    1721       /* Check if the file is to be opened as read only */
    1722       if(BST_CHECKED == SendDlgItemMessageA(hwnd,
    1723                                             IDC_OPENREADONLY,
    1724                                             BM_GETSTATE,0,0))
    1725           SetFileAttributesA(fodInfos->ofnInfos->lpstrFile,
    1726                              FILE_ATTRIBUTE_READONLY);
    1727 
    1728       /*  nFileExtension and nFileOffset of OPENFILENAME structure */
    1729       lpstrTemp = strrchr(fodInfos->ofnInfos->lpstrFile,'\\');
    1730       fodInfos->ofnInfos->nFileOffset = lpstrTemp - fodInfos->ofnInfos->lpstrFile + 1;
    1731       lpstrTemp = strrchr(fodInfos->ofnInfos->lpstrFile,'.');
    1732       fodInfos->ofnInfos->nFileExtension = lpstrTemp - fodInfos->ofnInfos->lpstrFile + 1;
    1733 
    1734 
    1735     /* clean and exit */
    1736     return EndDialog(hwnd,TRUE);
    1737   }
    1738 
    1739   return FALSE;
     1496      break;
     1497  }
     1498
     1499ret:
     1500  if(lpsf) IShellFolder_Release(lpsf);
     1501  return ret;
    17401502}
    17411503
     
    17521514
    17531515  /*
    1754    * Initialisation of the FileOpenDialogInfos structure
     1516   * Initialisation of the FileOpenDialogInfos structure 
    17551517   */
    17561518
    17571519  /* Shell */
    1758 
    1759   fodInfos->Shell.FOIShellView = NULL;
    1760   if(FAILED(COMDLG32_SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder)))
    1761     return E_FAIL;
    17621520
    17631521  /*ShellInfos */
    17641522  fodInfos->ShellInfos.hwndOwner = hwnd;
    17651523
    1766   fodInfos->ShellInfos.folderSettings.fFlags = 0;
    17671524  /* Disable multi-select if flag not set */
    17681525  if (!(fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT))
    17691526  {
    1770      fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL;
     1527     fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL; 
    17711528  }
    17721529  fodInfos->ShellInfos.folderSettings.fFlags |= FWF_AUTOARRANGE | FWF_ALIGNLEFT;
     
    17781535
    17791536  /* Construct the IShellBrowser interface */
    1780   fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);
    1781 
     1537  fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); 
     1538   
    17821539  return NOERROR;
    17831540}
     
    17941551
    17951552  IContextMenu * pcm;
    1796   CMINVOKECOMMANDINFO ci;
    1797   TRACE("\n");
     1553  TRACE("(0x%08x,%p)\n", hwnd, lpVerb);
    17981554
    17991555  if(SUCCEEDED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView,
    1800                                         SVGIO_BACKGROUND,
    1801                                         &IID_IContextMenu,
    1802                                         (LPVOID*)&pcm)))
    1803   {
     1556                                        SVGIO_BACKGROUND,
     1557                                        &IID_IContextMenu,
     1558                                        (LPVOID*)&pcm)))
     1559  {
     1560    CMINVOKECOMMANDINFO ci;
     1561    ZeroMemory(&ci, sizeof(CMINVOKECOMMANDINFO));
    18041562    ci.cbSize = sizeof(CMINVOKECOMMANDINFO);
    18051563    ci.lpVerb = lpVerb;
     
    18351593
    18361594/***********************************************************************
    1837  *      FILEDLG95_SHELL_NewFolder
    1838  *
    1839  * Creates a new directory with New folder as name
     1595 *      FILEDLG95_SHELL_BrowseToDesktop
     1596 *
     1597 * Browse to the Desktop
    18401598 * If the function succeeds, the return value is nonzero.
    1841  * FIXME: let the contextmenu (CMDSTR_NEWFOLDER) do this thing
    1842  */
    1843 static BOOL FILEDLG95_SHELL_NewFolder(HWND hwnd)
    1844 {
    1845   char lpstrDirName[MAX_PATH] = "New Folder";
    1846   char lpstrNewDir[MAX_PATH];
    1847   BOOL bRes = FALSE;
    1848   HANDLE hHandle;
    1849   WIN32_FIND_DATAA FindData;
     1599 */
     1600static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd)
     1601{
    18501602  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    1851 
     1603  LPITEMIDLIST pidl;
     1604  HRESULT hres;
     1605 
    18521606  TRACE("\n");
    18531607
    1854   /* Create the absolute path for "New Folder" */
    1855   COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, lpstrNewDir);
    1856   COMDLG32_PathAddBackslashA(lpstrNewDir);
    1857   strcat(lpstrNewDir, lpstrDirName);
    1858 
    1859   /* Find a Unique directory name */
    1860   hHandle = FindFirstFileA(lpstrNewDir,&FindData);
    1861   if(hHandle != INVALID_HANDLE_VALUE)
    1862   {
    1863     int i;
    1864     char lpstrDupNewDir[MAX_PATH];
    1865     char lpstrDirNameExt[8];
    1866     strcpy(lpstrDupNewDir, lpstrNewDir);
    1867     for(i=0; i < 256 && hHandle != INVALID_HANDLE_VALUE; i++)
    1868     {
    1869       FindClose(hHandle);
    1870       sprintf(lpstrNewDir,"%s (%d)", lpstrDupNewDir, i+1);
    1871       hHandle = FindFirstFileA(lpstrNewDir,&FindData);
    1872     }
    1873     sprintf(lpstrDirNameExt," (%d)", i);
    1874     strcat(lpstrDirName, lpstrDirNameExt);
    1875   }
    1876   /* Is Unique Found */
    1877   if(hHandle == INVALID_HANDLE_VALUE)
    1878   {
    1879     bRes = CreateDirectoryA(lpstrNewDir,NULL);
    1880 
    1881     if(bRes)
    1882     {
    1883       LPITEMIDLIST pidl;
    1884       /* Refresh the list (this will update the pidl, to include the new directory) */
    1885       /* Might want to only update the list (so the directory appears at the end    */
    1886       IShellView_Refresh(fodInfos->Shell.FOIShellView);
    1887       pidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,lpstrDirName);
    1888 
    1889       IShellView_SelectItem(fodInfos->Shell.FOIShellView,
    1890                     pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE
    1891                     |SVSI_FOCUSED|SVSI_SELECT));
    1892 
    1893       COMDLG32_SHFree(pidl);
    1894     }
    1895     else
    1896     {
    1897       char lpstrText[128+MAX_PATH];
    1898       char lpstrTempText[128];
    1899       char lpstrCaption[32];
    1900 
    1901       /* Cannot Create folder because of permissions */
    1902       LoadStringA(COMMDLG_hInstance32, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof(lpstrTempText));
    1903       LoadStringA(COMMDLG_hInstance32, IDS_FILEOPEN_CAPTION,    lpstrCaption,  sizeof(lpstrCaption));
    1904       sprintf(lpstrText,lpstrTempText, lpstrDirName);
    1905       MessageBoxA(hwnd,lpstrText, lpstrCaption, MB_OK | MB_ICONEXCLAMATION);
    1906     }
    1907   } else FindClose(hHandle);
    1908   return bRes;
    1909 }
    1910 
     1608  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl);
     1609  hres = IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidl, SBSP_ABSOLUTE);
     1610  COMDLG32_SHFree(pidl);
     1611  return SUCCEEDED(hres);
     1612}
    19111613/***********************************************************************
    19121614 *      FILEDLG95_SHELL_Clean
     
    19191621
    19201622    TRACE("\n");
     1623
     1624    COMDLG32_SHFree(fodInfos->ShellInfos.pidlAbsCurrent);
    19211625
    19221626    /* clean Shell interfaces */
     
    19251629    IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
    19261630    IShellBrowser_Release(fodInfos->Shell.FOIShellBrowser);
     1631    if (fodInfos->Shell.FOIDataObject)
     1632      IDataObject_Release(fodInfos->Shell.FOIDataObject);
    19271633}
    19281634
     
    19301636 *      FILEDLG95_FILETYPE_Init
    19311637 *
    1932  * Initialisation of the file type combo box
     1638 * Initialisation of the file type combo box 
    19331639 */
    19341640static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
     
    19401646  if(fodInfos->ofnInfos->lpstrFilter)
    19411647  {
    1942     int iStrIndex = 0;
    1943     int iPos = 0;
     1648    int nFilters = 0;   /* number of filters */
    19441649    LPSTR lpstrFilter;
    1945     LPSTR lpstrTmp;
     1650    LPCSTR lpstrPos = fodInfos->ofnInfos->lpstrFilter;
    19461651
    19471652    for(;;)
    19481653    {
    1949       /* filter is a list...  title\0ext\0......\0\0
     1654      /* filter is a list...  title\0ext\0......\0\0 
    19501655       * Set the combo item text to the title and the item data
    19511656       *  to the ext
    19521657       */
    1953       char *lpstrExt = NULL;
    1954       LPSTR lpstrExtTmp = NULL;
     1658      LPCSTR lpstrDisplay;
     1659      LPSTR lpstrExt;
    19551660
    19561661      /* Get the title */
    1957       lpstrTmp = (&((LPBYTE)fodInfos->ofnInfos->lpstrFilter)[iStrIndex]);
    1958       if(!strlen(lpstrTmp))
    1959         break;
    1960       iStrIndex += strlen(lpstrTmp) +1;
    1961       /* Get the extension */
    1962       lpstrExtTmp = (&((LPBYTE)fodInfos->ofnInfos->lpstrFilter)[iStrIndex]);
    1963       if(!lpstrExtTmp)
    1964           break;
    1965 
    1966       lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp)+1);
    1967       if(!lpstrExt)
    1968           break;
    1969 
    1970       strcpy(lpstrExt,lpstrExtTmp);
    1971 
    1972       iStrIndex += strlen(lpstrExt) +1;
    1973 
     1662      if(! *lpstrPos) break;    /* end */
     1663      lpstrDisplay = lpstrPos;
     1664      lpstrPos += strlen(lpstrPos) + 1;
     1665
     1666      /* Copy the extensions */
     1667      if (! *lpstrPos) return E_FAIL;   /* malformed filter */
     1668      if (!(lpstrExt = (LPSTR) MemAlloc(strlen(lpstrPos)+1))) return E_FAIL;
     1669      strcpy(lpstrExt,lpstrPos);
     1670      lpstrPos += strlen(lpstrPos) + 1;
     1671           
    19741672      /* Add the item at the end of the combo */
    1975       CBAddString(fodInfos->DlgInfos.hwndFileTypeCB,lpstrTmp);
    1976       CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos++,lpstrExt);
    1977     }
    1978       /* Set the current filter to the one specified
    1979        * in the initialisation structure
    1980       */
    1981 
    1982       /* set default filter index */
    1983       if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->ofnInfos->lpstrCustomFilter == NULL)
    1984         fodInfos->ofnInfos->nFilterIndex = 1;
    1985       /* First, check to make sure our index isn't out of bounds. */
    1986       if ( fodInfos->ofnInfos->nFilterIndex > iPos )
    1987         fodInfos->ofnInfos->nFilterIndex = iPos;
    1988 
    1989 
    1990       /* Get the current index selection. */
    1991       CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,
    1992                   fodInfos->ofnInfos->nFilterIndex-1);
    1993 
    1994       /* Get the corresponding text string from the combo box. */
    1995       lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
     1673      CBAddString(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
     1674      CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters, lpstrExt);
     1675      nFilters++;
     1676    }
     1677    /*
     1678     * Set the current filter to the one specified
     1679     * in the initialisation structure
     1680     * FIXME: lpstrCustomFilter not handled at all
     1681     */
     1682 
     1683    /* set default filter index */
     1684    if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->ofnInfos->lpstrCustomFilter == NULL)
     1685      fodInfos->ofnInfos->nFilterIndex = 1;
     1686
     1687    /* First, check to make sure our index isn't out of bounds. */
     1688    if ( fodInfos->ofnInfos->nFilterIndex > nFilters )
     1689      fodInfos->ofnInfos->nFilterIndex = nFilters;
     1690 
     1691    /* Set the current index selection. */
     1692    CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, fodInfos->ofnInfos->nFilterIndex-1);
     1693 
     1694    /* Get the corresponding text string from the combo box. */
     1695    lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
    19961696                                             fodInfos->ofnInfos->nFilterIndex-1);
    19971697
    1998       if ((INT)lpstrFilter == -1)
    1999         lpstrFilter = NULL;     // we get -1 if the control is empty
     1698    if ((INT)lpstrFilter == CB_ERR)  /* control is empty */
     1699      lpstrFilter = NULL;       
    20001700
    20011701    if(lpstrFilter)
    20021702    {
    2003         fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpstrFilter)+1)*2);
    2004         lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,strlwr(lpstrFilter));
     1703      _strlwr(lpstrFilter);     /* lowercase */
     1704      fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpstrFilter)+1)*2);
     1705      lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter, lpstrFilter);
    20051706    }
    20061707  }
     
    20261727      /* Get the current item of the filetype combo box */
    20271728      int iItem = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    2028 
    2029       if (iItem+1 == fodInfos->ofnInfos->nFilterIndex) break;
    20301729
    20311730      /* set the current filter index - indexed from 1 */
     
    20411740      {
    20421741        fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc((strlen(lpstrFilter)+1)*2);
    2043         lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,(LPSTR)strlwr((LPSTR)lpstrFilter));
     1742        lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,_strlwr(lpstrFilter));
    20441743        SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
    20451744      }
     
    20541753 *      FILEDLG95_FILETYPE_SearchExt
    20551754 *
    2056  * Search for pidl in the lookin combo box
    2057  * returns the index of the found item
    2058  */
    2059 static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPSTR lpstrExt)
    2060 {
    2061   int i = 0;
    2062   int iCount = CBGetCount(hwnd);
    2063 
    2064   TRACE("\n");
    2065 
    2066   for(;i<iCount;i++)
    2067   {
    2068       LPSTR ext = (LPSTR) CBGetItemDataPtr(hwnd,i);
    2069 
    2070       if(!strcasecmp(lpstrExt,ext))
     1755 * searches for a extension in the filetype box
     1756 */
     1757static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPCSTR lpstrExt)
     1758{
     1759  int i, iCount = CBGetCount(hwnd);
     1760
     1761  TRACE("%s\n", lpstrExt);
     1762
     1763  if(iCount != CB_ERR)
     1764  {
     1765    for(i=0;i<iCount;i++)
     1766    {
     1767      if(!strcasecmp(lpstrExt,(LPSTR)CBGetItemDataPtr(hwnd,i)))
    20711768          return i;
    2072   }
    2073 
     1769    }
     1770  }
    20741771  return -1;
    20751772}
     
    20891786
    20901787  /* Delete each string of the combo and their associated data */
    2091   for(iPos = iCount-1;iPos>=0;iPos--)
    2092   {
    2093     MemFree((LPVOID)(CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos)));
    2094     CBDeleteString(fodInfos->DlgInfos.hwndFileTypeCB,iPos);
     1788  if(iCount != CB_ERR)
     1789  {
     1790    for(iPos = iCount-1;iPos>=0;iPos--)
     1791    {
     1792      MemFree((LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iPos));
     1793      CBDeleteString(fodInfos->DlgInfos.hwndFileTypeCB,iPos);
     1794    }
    20951795  }
    20961796  /* Current filter */
    20971797  if(fodInfos->ShellInfos.lpstrCurrentFilter)
    2098      MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
    2099 
    2100 }
    2101 
     1798     MemFree(fodInfos->ShellInfos.lpstrCurrentFilter);
     1799
     1800}
     1801   
    21021802/***********************************************************************
    21031803 *      FILEDLG95_LOOKIN_Init
    21041804 *
    2105  * Initialisation of the look in combo box
     1805 * Initialisation of the look in combo box 
    21061806 */
    21071807static HRESULT FILEDLG95_LOOKIN_Init(HWND hwndCombo)
    21081808{
    2109   IShellFolder  *psfRoot, *psfDrives;
    2110   IEnumIDList   *lpeRoot, *lpeDrives;
    2111   LPITEMIDLIST  pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
     1809  IShellFolder  *psfRoot, *psfDrives;
     1810  IEnumIDList   *lpeRoot, *lpeDrives;
     1811  LPITEMIDLIST  pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp;
    21121812
    21131813  LookInInfos *liInfos = MemAlloc(sizeof(LookInInfos));
     
    21201820  CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON));
    21211821
    2122 #ifndef SHELL_NO_DESKTOP
    21231822  /* Initialise data of Desktop folder */
    21241823  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp);
    21251824  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
    21261825  COMDLG32_SHFree(pidlTmp);
    2127 #endif
    21281826
    21291827  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives);
     
    21381836      while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL))
    21391837      {
    2140         FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
    2141 
    2142         /* special handling for CSIDL_DRIVES */
    2143         if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives))
    2144         {
    2145           if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
    2146           {
    2147             /* enumerate the drives */
    2148             if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
    2149             {
    2150               while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
    2151               {
    2152                 pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1);
    2153                 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
    2154                 COMDLG32_SHFree(pidlAbsTmp);
    2155                 COMDLG32_SHFree(pidlTmp1);
    2156               }
    2157               IEnumIDList_Release(lpeDrives);
    2158             }
    2159             IShellFolder_Release(psfDrives);
    2160           }
    2161         }
     1838        FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
     1839
     1840        /* special handling for CSIDL_DRIVES */
     1841        if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives))
     1842        {
     1843          if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
     1844          {
     1845            /* enumerate the drives */
     1846            if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives)))
     1847            {
     1848              while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
     1849              {
     1850                pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1);
     1851                FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
     1852                COMDLG32_SHFree(pidlAbsTmp);
     1853                COMDLG32_SHFree(pidlTmp1);
     1854              }
     1855              IEnumIDList_Release(lpeDrives);
     1856            }
     1857            IShellFolder_Release(psfDrives);
     1858          }
     1859        }
    21621860        COMDLG32_SHFree(pidlTmp);
    21631861      }
     
    21681866  IShellFolder_Release(psfRoot);
    21691867  COMDLG32_SHFree(pidlDrives);
    2170 
    21711868  return NOERROR;
    21721869}
     
    21841881  RECT rectText;
    21851882  RECT rectIcon;
     1883  SHFILEINFOA sfi;
     1884  HIMAGELIST ilItemImage;
    21861885  int iIndentation;
    21871886  LPSFOLDER tmpFolder;
    2188   INT iIcon;
     1887
    21891888
    21901889  LookInInfos *liInfos = (LookInInfos *)GetPropA(pDIStruct->hwndItem,LookInInfosStr);
     
    21951894    return 0;
    21961895
    2197   if((LPSFOLDER)CB_ERR == (tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
     1896  if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
    21981897                            pDIStruct->itemID)))
    21991898    return 0;
    22001899
    2201   if (!tmpFolder->szDisplayName)
    2202   {
    2203     SHFILEINFOA sfi;
    2204     INT len;
    2205 
    2206     tmpFolder->ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR)tmpFolder->pidlItem,
    2207                                                   0,
    2208                                                   &sfi,
     1900
     1901  if(pDIStruct->itemID == liInfos->uSelectedItem)
     1902  {
     1903    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
     1904                                               0,   
     1905                                               &sfi,   
     1906                                               sizeof (SHFILEINFOA),   
     1907                                               SHGFI_PIDL | SHGFI_SMALLICON |   
     1908                                               SHGFI_OPENICON | SHGFI_SYSICONINDEX    |
     1909                                               SHGFI_DISPLAYNAME );   
     1910  }
     1911  else
     1912  {
     1913    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
     1914                                                  0,
     1915                                                  &sfi,
    22091916                                                  sizeof (SHFILEINFOA),
    2210                                                   SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME);
    2211     len = strlen(sfi.szDisplayName)+1;
    2212     tmpFolder->szDisplayName = MemAlloc(len);
    2213     strcpy(tmpFolder->szDisplayName,sfi.szDisplayName);
    2214     tmpFolder->iIcon = sfi.iIcon;
    2215   }
    2216 
    2217   if((pDIStruct->itemID == liInfos->uSelectedItem) || (pDIStruct->itemState & ODS_COMBOBOXEDIT))
    2218   {
    2219     if (!tmpFolder->iSelIcon)
    2220     {
    2221       SHFILEINFOA sfi2;
    2222 
    2223       COMDLG32_SHGetFileInfoA((LPCSTR)tmpFolder->pidlItem,0,&sfi2,sizeof(SHFILEINFOA),
    2224                               SHGFI_PIDL | SHGFI_SMALLICON |
    2225                               SHGFI_OPENICON | SHGFI_SYSICONINDEX);
    2226       tmpFolder->iSelIcon = sfi2.iIcon;
    2227     }
    2228     iIcon = tmpFolder->iSelIcon;
    2229   } else iIcon = tmpFolder->iIcon;
    2230 
     1917                                                  SHGFI_PIDL | SHGFI_SMALLICON |
     1918                                                  SHGFI_SYSICONINDEX |
     1919                                                  SHGFI_DISPLAYNAME);
     1920  }
    22311921
    22321922  /* Is this item selected ?*/
     
    22451935
    22461936  /* Do not indent item  if drawing in the edit of the combo*/
    2247   if (pDIStruct->itemState & ODS_COMBOBOXEDIT)
     1937  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
     1938  {
    22481939    iIndentation = 0;
     1940    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
     1941                                                0,
     1942                                                &sfi,
     1943                                                sizeof (SHFILEINFOA),
     1944                                                SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON
     1945                                                | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME  );
     1946
     1947  }
    22491948  else
     1949  {
    22501950    iIndentation = tmpFolder->m_iIndent;
    2251 
     1951  }
    22521952  /* Draw text and icon */
    22531953
     
    22641964  rectText.bottom = pDIStruct->rcItem.bottom;
    22651965
    2266 
     1966 
    22671967  /* Draw the icon from the image list */
    2268   COMDLG32_ImageList_Draw(tmpFolder->ilItemImage,
    2269                  iIcon,
    2270                  pDIStruct->hDC,
    2271                  rectIcon.left,
    2272                  rectIcon.top,
    2273                  ILD_TRANSPARENT );
     1968  COMDLG32_ImageList_Draw(ilItemImage,
     1969                 sfi.iIcon,
     1970                 pDIStruct->hDC, 
     1971                 rectIcon.left, 
     1972                 rectIcon.top, 
     1973                 ILD_TRANSPARENT ); 
    22741974
    22751975  /* Draw the associated text */
    2276   if (tmpFolder->szDisplayName)
    2277     TextOutA(pDIStruct->hDC,rectText.left,rectText.top,tmpFolder->szDisplayName,strlen(tmpFolder->szDisplayName));
     1976  if(sfi.szDisplayName)
     1977    TextOutA(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,strlen(sfi.szDisplayName));
    22781978
    22791979
     
    22911991  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    22921992
    2293   TRACE("\n");
     1993  TRACE("%p\n", fodInfos);
    22941994
    22951995  switch(wNotifyCode)
    22961996  {
    2297   case CBN_SELENDOK:
     1997    case CBN_SELENDOK:
    22981998    {
    22991999      LPSFOLDER tmpFolder;
    2300       int iItem;
     2000      int iItem; 
    23012001
    23022002      iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB);
     
    23042004      if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
    23052005                                               iItem)))
    2306         return FALSE;
     2006        return FALSE;
    23072007
    23082008
     
    23152015      break;
    23162016    }
    2317 
     2017     
    23182018  }
    23192019  return FALSE;
     
    23402040  if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr)))
    23412041    return -1;
    2342 
     2042   
    23432043  tmpFolder = MemAlloc(sizeof(SFOLDER));
    23442044  tmpFolder->m_iIndent = 0;
    2345   tmpFolder->szDisplayName = NULL;
    23462045
    23472046  /* Calculate the indentation of the item in the lookin*/
    23482047  pidlNext = pidl;
    2349   while((pidlNext = COMDLG32_PIDL_ILGetNext(pidlNext)) != NULL)
     2048  while( (pidlNext=COMDLG32_PIDL_ILGetNext(pidlNext)) )
    23502049  {
    23512050    tmpFolder->m_iIndent++;
    23522051  }
    23532052
    2354   tmpFolder->pidlItem = COMDLG32_PIDL_ILClone(pidl);
     2053  tmpFolder->pidlItem = COMDLG32_PIDL_ILClone(pidl); /* FIXME: memory leak*/
    23552054
    23562055  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
    23572056    liInfos->iMaxIndentation = tmpFolder->m_iIndent;
    2358 
     2057 
     2058  sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
    23592059  COMDLG32_SHGetFileInfoA((LPSTR)pidl,
    23602060                  0,
    23612061                  &sfi,
    23622062                  sizeof(sfi),
    2363                   SHGFI_PIDL | SHGFI_ATTRIBUTES);
     2063                  SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX
     2064                  | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED);
     2065
    23642066
    23652067  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
    23662068  {
    23672069    int iItemID;
    2368 
     2070 
    23692071    /* Add the item at the end of the list */
    23702072    if(iInsertId < 0)
    23712073    {
    2372       iItemID = CBAddString(hwnd,NULL);
     2074      iItemID = CBAddString(hwnd,sfi.szDisplayName);
    23732075    }
    23742076    /* Insert the item at the iInsertId position*/
    23752077    else
    23762078    {
    2377       iItemID = CBInsertString(hwnd,NULL,iInsertId);
    2378     }
    2379 
    2380         CBSetItemDataPtr(hwnd,iItemID,tmpFolder);
    2381         return iItemID;
    2382   }
    2383 
    2384   MemFree(tmpFolder);
     2079      iItemID = CBInsertString(hwnd,sfi.szDisplayName,iInsertId);
     2080    }
     2081
     2082    CBSetItemDataPtr(hwnd,iItemID,tmpFolder);
     2083    return iItemID;
     2084  }
     2085
     2086  MemFree( tmpFolder );
    23852087  return -1;
     2088
    23862089}
    23872090
     
    23892092 *      FILEDLG95_LOOKIN_InsertItemAfterParent
    23902093 *
    2391  * Insert an item below its parent
     2094 * Insert an item below its parent 
    23922095 */
    23932096static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl)
    23942097{
    2395 
     2098 
    23962099  LPITEMIDLIST pidlParent = GetParentPidl(pidl);
    23972100  int iParentPos;
     
    24482151    }
    24492152  }
    2450 
     2153 
    24512154  CBSetCurSel(hwnd,iItemPos);
    24522155  liInfos->uSelectedItem = iItemPos;
     
    24742177  if((iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)liInfos->iMaxIndentation,SEARCH_EXP)) >=0)
    24752178  {
    2476     SFOLDER *tmpFolder;
    2477 
    2478     tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
    2479     if (tmpFolder->szDisplayName) MemFree(tmpFolder->szDisplayName);
     2179    SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
     2180    COMDLG32_SHFree(tmpFolder->pidlItem);
    24802181    MemFree(tmpFolder);
    24812182    CBDeleteString(hwnd,iItemPos);
     
    25012202  TRACE("\n");
    25022203
    2503   for(;i<iCount;i++)
    2504   {
    2505     LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
    2506 
    2507     if(iSearchMethod == SEARCH_PIDL && COMDLG32_PIDL_ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem))
    2508       return i;
    2509     if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
    2510       return i;
    2511 
     2204  if (iCount != CB_ERR)
     2205  {
     2206    for(;i<iCount;i++)
     2207    {
     2208      LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
     2209
     2210      if(iSearchMethod == SEARCH_PIDL && COMDLG32_PIDL_ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem))
     2211        return i;
     2212      if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
     2213        return i;
     2214    }
    25122215  }
    25132216
     
    25292232
    25302233    /* Delete each string of the combo and their associated data */
    2531     for(iPos = iCount-1;iPos>=0;iPos--)
     2234    if (iCount != CB_ERR)
    25322235    {
    2533       SFOLDER *tmpFolder = (LPSFOLDER)CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
    2534 
    2535       if (tmpFolder->szDisplayName) MemFree(tmpFolder->szDisplayName);
    2536       MemFree(tmpFolder);
    2537       CBDeleteString(fodInfos->DlgInfos.hwndLookInCB,iPos);
    2538     }
     2236      for(iPos = iCount-1;iPos>=0;iPos--)
     2237      {
     2238        SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,iPos);
     2239        COMDLG32_SHFree(tmpFolder->pidlItem);
     2240        MemFree(tmpFolder);
     2241        CBDeleteString(fodInfos->DlgInfos.hwndLookInCB,iPos);
     2242      }
     2243    }
     2244
    25392245    /* LookInInfos structure */
    25402246    RemovePropA(fodInfos->DlgInfos.hwndLookInCB,LookInInfosStr);
    25412247
    25422248}
     2249/***********************************************************************
     2250 * FILEDLG95_FILENAME_FillFromSelection
     2251 *
     2252 * fills the edit box from the cached DataObject
     2253 */
     2254void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
     2255{
     2256    FileOpenDlgInfos *fodInfos;
     2257    LPITEMIDLIST      pidl;
     2258    UINT              nFiles = 0, nFileToOpen, nFileSelected, nLength = 0;
     2259    char              lpstrTemp[MAX_PATH];
     2260    LPSTR             lpstrAllFile = NULL, lpstrCurrFile = NULL;
     2261
     2262    TRACE("\n");
     2263    fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     2264
     2265    /* Count how many files we have */
     2266    nFileSelected = GetNumSelected( fodInfos->Shell.FOIDataObject );
     2267
     2268    /* calculate the string length, count files */
     2269    if (nFileSelected >= 1)
     2270    {
     2271      nLength += 3;     /* first and last quotes, trailing \0 */
     2272      for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ )
     2273      {
     2274        pidl = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, nFileToOpen+1 );
     2275   
     2276        if (pidl)
     2277        {
     2278          /* get the total length of the selected file names*/
     2279          lpstrTemp[0] = '\0';
     2280          GetName( fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER, lpstrTemp );
     2281
     2282          if ( ! IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl) ) /* Ignore folders */
     2283          {
     2284            nLength += strlen( lpstrTemp ) + 3;
     2285            nFiles++;
     2286          }
     2287          COMDLG32_SHFree( pidl );
     2288        }
     2289      }
     2290    }
     2291
     2292    /* allocate the buffer */
     2293    if (nFiles <= 1) nLength = MAX_PATH;
     2294    lpstrAllFile = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength);
     2295    lpstrAllFile[0] = '\0';
     2296
     2297    /* Generate the string for the edit control */
     2298    if(nFiles >= 1)
     2299    {
     2300      lpstrCurrFile = lpstrAllFile;
     2301      for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ )
     2302      {
     2303        pidl = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, nFileToOpen+1 );
     2304
     2305        if (pidl)
     2306        {
     2307          /* get the file name */
     2308          lpstrTemp[0] = '\0';
     2309          GetName( fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER, lpstrTemp );
     2310
     2311          if (! IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl)) /* Ignore folders */
     2312          {
     2313            if ( nFiles > 1)
     2314            {
     2315              *lpstrCurrFile++ =  '\"';
     2316              strcpy( lpstrCurrFile, lpstrTemp );
     2317              lpstrCurrFile += strlen( lpstrTemp );
     2318              strcpy( lpstrCurrFile, "\" " );
     2319              lpstrCurrFile += 2;
     2320            }
     2321            else
     2322            {
     2323              strcpy( lpstrAllFile, lpstrTemp );
     2324            }
     2325          }
     2326          COMDLG32_SHFree( (LPVOID) pidl );
     2327        }
     2328      }
     2329    }
     2330
     2331    SetWindowTextA( fodInfos->DlgInfos.hwndFileName, lpstrAllFile );
     2332    HeapFree(GetProcessHeap(),0, lpstrAllFile );
     2333}
     2334
     2335
     2336/* copied from shell32 to avoid linking to it */
     2337static HRESULT COMDLG32_StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
     2338{
     2339        switch (src->uType)
     2340        {
     2341          case STRRET_WSTR:
     2342            WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);
     2343            COMDLG32_SHFree(src->u.pOleStr);
     2344            break;
     2345
     2346          case STRRET_CSTRA:
     2347            lstrcpynA((LPSTR)dest, src->u.cStr, len);
     2348            break;
     2349
     2350          case STRRET_OFFSETA:
     2351            lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
     2352            break;
     2353
     2354          default:
     2355            FIXME("unknown type!\n");
     2356            if (len)
     2357            {
     2358              *(LPSTR)dest = '\0';
     2359            }
     2360            return(FALSE);
     2361        }
     2362        return S_OK;
     2363}
     2364
     2365/***********************************************************************
     2366 * FILEDLG95_FILENAME_GetFileNames
     2367 *
     2368 * copies the filenames to a 0-delimited string list (A\0B\0C\0\0)
     2369 */
     2370int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPSTR * lpstrFileList, UINT * sizeUsed)
     2371{
     2372        FileOpenDlgInfos *fodInfos  = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     2373        UINT nStrCharCount = 0; /* index in src buffer */
     2374        UINT nFileIndex = 0;    /* index in dest buffer */
     2375        UINT nFileCount = 0;    /* number of files */
     2376        UINT nStrLen = 0;       /* length of string in edit control */
     2377        LPSTR lpstrEdit;        /* buffer for string from edit control */
     2378
     2379        TRACE("\n");
     2380
     2381        /* get the filenames from the edit control */
     2382        nStrLen = SendMessageA(fodInfos->DlgInfos.hwndFileName, WM_GETTEXTLENGTH, 0, 0);
     2383        lpstrEdit = MemAlloc(nStrLen+1);
     2384        GetDlgItemTextA(hwnd, IDC_FILENAME, lpstrEdit, nStrLen+1);
     2385
     2386        TRACE("nStrLen=%u str=%s\n", nStrLen, lpstrEdit);
     2387       
     2388        /* we might get single filename without any '"',
     2389         * so we need nStrLen + terminating \0 + end-of-list \0 */
     2390        *lpstrFileList = MemAlloc(nStrLen+2);
     2391        *sizeUsed = 0;
     2392
     2393        /* build 0-delimited file list from filenames */
     2394        while ( nStrCharCount <= nStrLen )
     2395        {
     2396          if ( lpstrEdit[nStrCharCount]=='"' )
     2397          {
     2398            nStrCharCount++;
     2399            while ((lpstrEdit[nStrCharCount]!='"') && (nStrCharCount <= nStrLen))
     2400            {
     2401              (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
     2402              (*sizeUsed)++;
     2403              nStrCharCount++;
     2404            }
     2405            (*lpstrFileList)[nFileIndex++] = '\0';
     2406            (*sizeUsed)++;
     2407            nFileCount++;
     2408          }
     2409          nStrCharCount++;
     2410        }
     2411
     2412        /* single, unquoted string */
     2413        if ((nStrLen > 0) && (*sizeUsed == 0) )
     2414        {
     2415          strcpy(*lpstrFileList, lpstrEdit);
     2416          nFileIndex = strlen(lpstrEdit) + 1;
     2417          (*sizeUsed) = nFileIndex;
     2418          nFileCount = 1;
     2419        }
     2420
     2421        /* trailing \0 */
     2422        (*lpstrFileList)[nFileIndex] = '\0';
     2423        (*sizeUsed)++;
     2424
     2425        MemFree(lpstrEdit);
     2426        return nFileCount;
     2427}
     2428
     2429#define SETDefFormatEtc(fe,cf,med) \
     2430{ \
     2431    (fe).cfFormat = cf;\
     2432    (fe).dwAspect = DVASPECT_CONTENT; \
     2433    (fe).ptd =NULL;\
     2434    (fe).tymed = med;\
     2435    (fe).lindex = -1;\
     2436};
     2437
     2438/*
     2439 * DATAOBJECT Helper functions
     2440 */
     2441
     2442/***********************************************************************
     2443 * COMCTL32_ReleaseStgMedium
     2444 *
     2445 * like ReleaseStgMedium from ole32
     2446 */
     2447static void COMCTL32_ReleaseStgMedium (STGMEDIUM medium)
     2448{
     2449      if(medium.pUnkForRelease)
     2450      {
     2451        IUnknown_Release(medium.pUnkForRelease);
     2452      }
     2453      else
     2454      {
     2455        GlobalUnlock(medium.u.hGlobal);
     2456        GlobalFree(medium.u.hGlobal);
     2457      }
     2458}
     2459
     2460/***********************************************************************
     2461 *          GetPidlFromDataObject
     2462 *
     2463 * Return pidl(s) by number from the cached DataObject
     2464 *
     2465 * nPidlIndex=0 gets the fully qualified root path
     2466 */
     2467LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex)
     2468{
     2469     
     2470    STGMEDIUM medium;
     2471    FORMATETC formatetc;
     2472    LPITEMIDLIST pidl = NULL;
     2473   
     2474    TRACE("sv=%p index=%u\n", doSelected, nPidlIndex);
     2475   
     2476    /* Set the FORMATETC structure*/
     2477    SETDefFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
     2478
     2479    /* Get the pidls from IDataObject */
     2480    if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
     2481    {
     2482      LPIDA cida = GlobalLock(medium.u.hGlobal);
     2483      if(nPidlIndex <= cida->cidl)
     2484      {
     2485        pidl = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex]]));
     2486      }
     2487      COMCTL32_ReleaseStgMedium(medium);
     2488    }
     2489    return pidl;
     2490}
     2491
     2492/***********************************************************************
     2493 *          GetNumSelected
     2494 *
     2495 * Return the number of selected items in the DataObject.
     2496 *
     2497*/
     2498UINT GetNumSelected( IDataObject *doSelected )
     2499{
     2500    UINT retVal = 0;
     2501    STGMEDIUM medium;
     2502    FORMATETC formatetc;
     2503
     2504    TRACE("sv=%p\n", doSelected);
     2505
     2506    if (!doSelected) return 0;
     2507
     2508    /* Set the FORMATETC structure*/
     2509    SETDefFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
     2510
     2511    /* Get the pidls from IDataObject */
     2512    if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
     2513    {
     2514      LPIDA cida = GlobalLock(medium.u.hGlobal);
     2515      retVal = cida->cidl;
     2516      COMCTL32_ReleaseStgMedium(medium);
     2517      return retVal;
     2518    }
     2519    return 0;
     2520}
     2521
    25432522/*
    25442523 * TOOLS
     
    25482527 *      GetName
    25492528 *
    2550  * Get the pidl's display name (relative to folder) and
     2529 * Get the pidl's display name (relative to folder) and 
    25512530 * put it in lpstrFileName.
    2552  *
     2531 * 
    25532532 * Return NOERROR on success,
    25542533 * E_FAIL otherwise
     
    25602539  HRESULT hRes;
    25612540
    2562   TRACE("%p %p\n", lpsf, pidl);
     2541  TRACE("sf=%p pidl=%p\n", lpsf, pidl);
    25632542
    25642543  if(!lpsf)
     
    25722551
    25732552  /* Get the display name of the pidl relative to the folder */
    2574   if (SUCCEEDED(hRes = IShellFolder_GetDisplayNameOf(lpsf,
    2575                                                      pidl,
    2576                                                      dwFlags,
    2577                                                      &str)))
    2578   {
    2579       return StrRetToBufA(&str, pidl,lpstrFileName, MAX_PATH);
     2553  if (SUCCEEDED(hRes = IShellFolder_GetDisplayNameOf(lpsf, pidl, dwFlags, &str)))
     2554  {
     2555      return COMDLG32_StrRetToStrNA(lpstrFileName, MAX_PATH, &str, pidl);
    25802556  }
    25812557  return E_FAIL;
     
    25852561 *      GetShellFolderFromPidl
    25862562 *
    2587  * pidlRel is the item pidl relative
     2563 * pidlRel is the item pidl relative 
    25882564 * Return the IShellFolder of the absolute pidl
    25892565 */
     
    26012577      if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
    26022578      {
    2603         IShellFolder_Release(psfParent);
     2579        IShellFolder_Release(psfParent);
    26042580        return psf;
    26052581      }
     
    26242600  pidlParent = COMDLG32_PIDL_ILClone(pidl);
    26252601  COMDLG32_PIDL_ILRemoveLastID(pidlParent);
    2626 
     2602     
    26272603  return pidlParent;
    26282604}
     
    26312607 *      GetPidlFromName
    26322608 *
    2633  * returns the pidl of the file name relative to folder
     2609 * returns the pidl of the file name relative to folder 
    26342610 * NULL if an error occured
    26352611 */
    2636 LPITEMIDLIST GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName)
     2612LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName)
    26372613{
    26382614  LPITEMIDLIST pidl;
    26392615  ULONG ulEaten;
    2640   wchar_t lpwstrDirName[MAX_PATH];
    2641 
    2642 
    2643   TRACE("sf=%p file=%s\n", psf, lpcstrFileName);
    2644 
    2645   if(!lpcstrFileName)
    2646     return NULL;
    2647 
    2648   MultiByteToWideChar(CP_ACP,
    2649                       MB_PRECOMPOSED,
    2650                       lpcstrFileName,
    2651                       -1,
    2652                       (LPWSTR)lpwstrDirName,
    2653                       MAX_PATH);
    2654 
    2655   IShellFolder_ParseDisplayName(psf,                                0,
    2656                                              NULL,
    2657                                              (LPWSTR)lpwstrDirName,
    2658                                              &ulEaten,
    2659                                              &pidl,
    2660                                 NULL);
    2661 
    2662     return pidl;
    2663 }
    2664 
    2665 /***********************************************************************
    2666  *      GetFileExtension
    2667  *
    2668  */
    2669 BOOL GetFileExtension(IShellFolder *psf,LPITEMIDLIST pidl,LPSTR lpstrFileExtension)
    2670 {
    2671   char FileName[MAX_PATH];
    2672   int result;
    2673   char *pdest;
    2674   int ch = '.';
    2675 
    2676   if(SUCCEEDED(GetName(psf,pidl,SHGDN_NORMAL,FileName)))
    2677   {
    2678     if(!(pdest = strrchr( FileName, ch )))
    2679       return FALSE;
    2680 
    2681     result = pdest - FileName + 1;
    2682     strcpy(lpstrFileExtension,&FileName[result]);
    2683     return TRUE;
    2684   }
    2685   return FALSE;
    2686 }
     2616  WCHAR lpwstrDirName[MAX_PATH];
     2617
     2618  TRACE("sf=%p file=%s\n", lpsf, lpcstrFileName);
     2619
     2620  if(!lpcstrFileName) return NULL;
     2621   
     2622  MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH); 
     2623
     2624  if(!lpsf)
     2625  {
     2626    COMDLG32_SHGetDesktopFolder(&lpsf);
     2627    pidl = GetPidlFromName(lpsf, lpcstrFileName);
     2628    IShellFolder_Release(lpsf);
     2629  }
     2630  else
     2631  {
     2632    IShellFolder_ParseDisplayName(lpsf, 0, NULL, (LPWSTR)lpwstrDirName, &ulEaten, &pidl, NULL);
     2633  }
     2634  return pidl;
     2635}
     2636
     2637/*
     2638*/
     2639BOOL IsPidlFolder (LPSHELLFOLDER psf, LPITEMIDLIST pidl)
     2640{
     2641        ULONG uAttr  = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
     2642        HRESULT ret;
     2643       
     2644        TRACE("%p, %p\n", psf, pidl);
     2645       
     2646        ret = IShellFolder_GetAttributesOf( psf, 1, &pidl, &uAttr );
     2647       
     2648        TRACE("-- 0x%08lx 0x%08lx\n", uAttr, ret);
     2649        /* see documentation shell 4.1*/
     2650        return uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER);
     2651}
     2652
     2653/***********************************************************************
     2654 *      BrowseSelectedFolder
     2655 */
     2656static BOOL BrowseSelectedFolder(HWND hwnd)
     2657{
     2658  BOOL bBrowseSelFolder = FALSE;
     2659  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     2660
     2661  TRACE("\n");
     2662
     2663  if (GetNumSelected(fodInfos->Shell.FOIDataObject) == 1)
     2664  {
     2665      LPITEMIDLIST pidlSelection;
     2666
     2667      /* get the file selected */
     2668      pidlSelection  = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, 1);
     2669      if (IsPidlFolder (fodInfos->Shell.FOIShellFolder, pidlSelection))
     2670      {
     2671          if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
     2672                         pidlSelection, SBSP_RELATIVE ) ) )
     2673          {
     2674               MessageBoxA( hwnd, "Path does not exist", fodInfos->ofnInfos->lpstrTitle,
     2675                      MB_OK | MB_ICONEXCLAMATION );
     2676          }
     2677
     2678         bBrowseSelFolder = TRUE;
     2679      }
     2680      COMDLG32_SHFree( pidlSelection );
     2681  }
     2682
     2683  return bBrowseSelFolder;
     2684}
    26872685
    26882686/*
    26892687 * Memory allocation methods */
    2690 void *MemAlloc(UINT size)
     2688static void *MemAlloc(UINT size)
    26912689{
    26922690    return HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size);
    26932691}
    26942692
    2695 void MemFree(void *mem)
     2693static void MemFree(void *mem)
    26962694{
    26972695    if(mem)
     
    27012699}
    27022700
    2703 /***********************************************************************
    2704  *      BrowseSelectedFolder
    2705  *
    2706  */
    2707 static BOOL BrowseSelectedFolder(HWND hwnd)
    2708 {
    2709   BOOL bBrowseSelFolder = FALSE;
    2710 
    2711   FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    2712 
    2713   if (GetNumSelected(fodInfos->Shell.FOIShellView) == 1)
    2714   {
    2715       LPITEMIDLIST pidlSelection;
    2716       ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    2717 
    2718       /* get the file selected */
    2719       EnumSelectedPidls( fodInfos->Shell.FOIShellView, 0, &pidlSelection );
    2720       IShellFolder_GetAttributesOf( fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr );
    2721       if ( uAttr & SFGAO_FOLDER )
    2722       {
    2723           if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
    2724                           pidlSelection, SBSP_RELATIVE ) ) )
    2725           {
    2726                MessageBoxA( hwnd, "Path does not exist", fodInfos->ofnInfos->lpstrTitle,
    2727                        MB_OK | MB_ICONEXCLAMATION );
    2728           }
    2729 
    2730           bBrowseSelFolder = TRUE;
    2731       }
    2732       COMDLG32_SHFree( pidlSelection );
    2733   }
    2734 
    2735   return bBrowseSelFolder;
    2736 }
    2737 
  • trunk/src/comdlg32/filedlgbrowser.c

    r3256 r4511  
    1 /* $Id: filedlgbrowser.c,v 1.5 2000-03-28 15:26:48 cbratschi Exp $ */
    21/*
    32 *  Implementation of IShellBrowser for the File Open common dialog
     3 *
    44 *
    5  * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
    6  * Project Odin Software License can be found in LICENSE.TXT
    7  *
    8  *  Corel WINE 20000324 level
    95 */
    106
     
    2218#include "unknwn.h"
    2319#include "filedlgbrowser.h"
     20#include "windef.h"
     21#include "wingdi.h"
    2422#include "winuser.h"
     23#include "wine/winestring.h"
    2524#include "heap.h"
     25#include "shlguid.h"
    2626#include "wine/obj_dataobject.h"
    2727#include "debugtools.h"
    2828#include "cdlg.h"
    29 #include "wine/undocshell.h"
    30 
    31 DEFAULT_DEBUG_CHANNEL(commdlg)
    32 
    33 #define SETDefFormatEtc(fe,cf,med) \
    34 { \
    35     (fe).cfFormat = cf;\
    36     (fe).dwAspect = DVASPECT_CONTENT; \
    37     (fe).ptd =NULL;\
    38     (fe).tymed = med;\
    39     (fe).lindex = -1;\
    40 };
    41 
     29
     30DEFAULT_DEBUG_CHANNEL(commdlg);
    4231
    4332/**************************************************************************
     
    9685*   External Prototypes
    9786*/
    98 extern const char *FileOpenDlgInfosStr;
     87extern const char *FileOpenDlgInfosStr; 
    9988
    10089extern HRESULT          GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
     
    121110    FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
    122111
    123     sb=(IShellBrowserImpl*)SHAlloc(sizeof(IShellBrowserImpl));
     112    sb=(IShellBrowserImpl*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl));
    124113
    125114    /* Initialisation of the member variables */
     
    131120    sb->lpVtbl2 = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
    132121
    133     COMDLG32_SHGetSpecialFolderLocation(hwndOwner,
    134                                CSIDL_DESKTOP,
     122    COMDLG32_SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
    135123                               &fodInfos->ShellInfos.pidlAbsCurrent);
    136124
     
    155143*/
    156144HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
    157                                             REFIID riid,
     145                                            REFIID riid, 
    158146                                            LPVOID *ppvObj)
    159147{
     
    165153
    166154    if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    167     { *ppvObj = This;
     155    { *ppvObj = This; 
    168156    }
    169157    else if(IsEqualIID(riid, &IID_IOleWindow))  /*IOleWindow*/
     
    207195    TRACE("(%p)\n", This);
    208196
    209     if (!--(This->ref))
    210     {
    211       COMDLG32_SHFree(This);
     197    if (!--(This->ref)) 
     198    { 
     199      HeapFree(GetProcessHeap(),0, This);
    212200      return 0;
    213201    }
     
    227215*
    228216*  Note : We will never be window less in the File Open dialog
    229 *
    230 */
    231 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
     217* 
     218*/
     219HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
    232220                                           HWND * phwnd)
    233221{
     
    241229    *phwnd = This->hwndOwner;
    242230
    243     return (*phwnd) ? S_OK : E_UNEXPECTED;
     231    return (*phwnd) ? S_OK : E_UNEXPECTED; 
    244232
    245233}
     
    268256*  See Windows documentation on IShellBrowser::BrowseObject for more details
    269257*
    270 *  This function will override user specified flags and will always
    271 *  use SBSP_DEFBROWSER and SBSP_DEFMODE.
    272 */
    273 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
    274                                               LPCITEMIDLIST pidl,
     258*  This function will override user specified flags and will always 
     259*  use SBSP_DEFBROWSER and SBSP_DEFMODE. 
     260*/
     261HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 
     262                                              LPCITEMIDLIST pidl, 
    275263                                              UINT wFlags)
    276264{
     
    280268    FileOpenDlgInfos *fodInfos;
    281269    LPITEMIDLIST pidlTmp;
    282 
    283     ICOM_THIS(IShellBrowserImpl, iface);
    284 
    285     TRACE("(%p)\n", This);
     270    HWND hwndView;
     271    HWND hDlgWnd;
     272    BOOL bViewHasFocus;
     273
     274    ICOM_THIS(IShellBrowserImpl, iface);
     275
     276    TRACE("(%p)(%p,0x%08x)\n", This, pidl, wFlags);
    286277
    287278    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     
    290281    if(wFlags & SBSP_RELATIVE)
    291282    {
    292 
     283       
    293284        /* SBSP_RELATIVE  A relative pidl (relative from the current folder) */
    294         hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
    295                                      pidl,
    296                                      NULL,
    297                                      &IID_IShellFolder,
    298                                      (LPVOID *)&psfTmp);
    299         if(FAILED(hRes))
     285        if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
     286             pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
    300287        {
    301             return hRes;
     288            ERR("bind to object failed\n");
     289            return hRes;
    302290        }
    303291        /* create an absolute pidl */
    304292        pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
    305293                                                        (LPITEMIDLIST)pidl);
    306 
    307294    }
    308295    else if(wFlags & SBSP_PARENT)
    309296    {
    310297        /* Browse the parent folder (ignores the pidl) */
    311 
    312298        pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
    313299        psfTmp = GetShellFolderFromPidl(pidlTmp);
    314300
    315301    }
    316     else
     302    else /* SBSP_ABSOLUTE is 0x0000 */
    317303    {
    318304        /* An absolute pidl (relative from the desktop) */
     
    320306        psfTmp = GetShellFolderFromPidl(pidlTmp);
    321307    }
    322 
    323 
    324     /* Retrieve the IShellFolder interface of the pidl specified folder */
    325     if(!psfTmp)
    326         return E_FAIL;
    327 
    328     /* If the pidl to browse to is equal to the actual pidl ...
     308   
     309    if(!psfTmp) return E_FAIL;
     310
     311    /* If the pidl to browse to is equal to the actual pidl ...
    329312       do nothing and pretend you did it*/
    330313    if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
    331314    {
    332315        IShellFolder_Release(psfTmp);
    333         COMDLG32_SHFree(pidlTmp);
     316        COMDLG32_SHFree(pidlTmp);
    334317        return NOERROR;
    335318    }
    336 #ifdef SHELL_NO_DESKTOP
    337 
    338     if(pidlTmp->mkid.cb == 0x00)
    339     {
    340         IShellFolder_Release(psfTmp);
    341                 COMDLG32_SHFree(pidlTmp);
    342         return NOERROR;
    343     }
    344 #endif
    345 
    346     /* Release the current fodInfos->Shell.FOIShellFolder and update its value */
    347     IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
     319
     320    /* Release the current DataObject */
     321    if (fodInfos->Shell.FOIDataObject)
     322    {
     323      IDataObject_Release(fodInfos->Shell.FOIDataObject);
     324      fodInfos->Shell.FOIDataObject = NULL;
     325    }
     326
     327    /* Create the associated view */
     328    if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
     329           &IID_IShellView, (LPVOID *)&psvTmp))) return hRes;
     330
     331    /* Check if listview has focus */
     332    bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
     333
     334    /* Get the foldersettings from the old view */
     335    if(fodInfos->Shell.FOIShellView)
     336      IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
     337
     338    /* Release the old fodInfos->Shell.FOIShellView and update its value.
     339    We have to update this early since ShellView_CreateViewWindow of native
     340    shell32 calls OnStateChange and needs the correct view here.*/
     341    if(fodInfos->Shell.FOIShellView)
     342    {
     343      IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
     344      IShellView_Release(fodInfos->Shell.FOIShellView);
     345    }
     346    fodInfos->Shell.FOIShellView = psvTmp;
     347
     348    /* Release old FOIShellFolder and update its value */
     349    if (fodInfos->Shell.FOIShellFolder)
     350      IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
    348351    fodInfos->Shell.FOIShellFolder = psfTmp;
    349352
    350     /* Create the associated view */
    351     if(SUCCEEDED(hRes = IShellFolder_CreateViewObject(psfTmp,
    352                                                       fodInfos->ShellInfos.hwndOwner,
    353                                                       &IID_IShellView,
    354                                                       (LPVOID *)&psvTmp)))
    355     {
    356         HWND hwndView;
    357         HWND hDlgWnd;
    358         BOOL bViewHasFocus;
    359 
    360         /* Check if listview has focus */
    361         bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
    362 
    363         /* Get the foldersettings from the old view */
    364         if(fodInfos->Shell.FOIShellView)
    365         {
    366           IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView,
    367                                   &fodInfos->ShellInfos.folderSettings);
    368         }
    369 
    370         /* Create the window */
    371         if(SUCCEEDED(hRes = IShellView_CreateViewWindow(psvTmp,
    372                                           NULL,
    373                                           &fodInfos->ShellInfos.folderSettings,
    374                                           fodInfos->Shell.FOIShellBrowser,
    375                                           &fodInfos->ShellInfos.rectView,
    376                                           &hwndView)))
    377         {
    378             /* Fit the created view in the appropriate RECT */
    379             MoveWindow(hwndView,
    380                        fodInfos->ShellInfos.rectView.left,
    381                        fodInfos->ShellInfos.rectView.top,
    382                        fodInfos->ShellInfos.rectView.right-fodInfos->ShellInfos.rectView.left,
    383                        fodInfos->ShellInfos.rectView.bottom-fodInfos->ShellInfos.rectView.top,
    384                        FALSE);
    385 
    386             /* Select the new folder in the Look In combo box of the Open file dialog */
    387 
    388             FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,pidlTmp);
    389 
    390             /* Release old pidlAbsCurrent memory and update its value */
    391             COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
    392             fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
    393 
    394             /* Release the current fodInfos->Shell.FOIShellView and update its value */
    395             if(fodInfos->Shell.FOIShellView)
    396             {
    397                 IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
    398                 IShellView_Release(fodInfos->Shell.FOIShellView);
    399             }
    400 #if 0
    401             ShowWindow(fodInfos->ShellInfos.hwndView,SW_HIDE);
    402 #endif
    403             fodInfos->Shell.FOIShellView = psvTmp;
    404 
    405             fodInfos->ShellInfos.hwndView = hwndView;
    406 
    407             /* changes the tab order of the ListView to reflect the window's File Dialog */
    408             hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
    409             SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
    410 
    411             /* Since we destroyed the old view if it had focus set focus
    412                to the newly created view */
    413             if (bViewHasFocus)
    414                 SetFocus(fodInfos->ShellInfos.hwndView);
    415 
    416             return NOERROR;
    417         }
    418     }
    419 
     353    /* Release old pidlAbsCurrent and update its value */
     354    COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
     355    fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
     356
     357    /* Create the window */
     358    TRACE("create view window\n");
     359    if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
     360         &fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
     361         &fodInfos->ShellInfos.rectView, &hwndView))) return hRes;
     362
     363    fodInfos->ShellInfos.hwndView = hwndView;
     364
     365    /* Select the new folder in the Look In combo box of the Open file dialog */
    420366    FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
    421     return hRes;
     367
     368    /* changes the tab order of the ListView to reflect the window's File Dialog */
     369    hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
     370    SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
     371
     372    /* Since we destroyed the old view if it had focus set focus to the newly created view */
     373    if (bViewHasFocus)
     374      SetFocus(fodInfos->ShellInfos.hwndView);
     375
     376    return hRes;
    422377}
    423378
     
    425380*  IShellBrowserImpl_EnableModelessSB
    426381*/
    427 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
     382HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
    428383                                              BOOL fEnable)
    429 
     384                                             
    430385{
    431386    ICOM_THIS(IShellBrowserImpl, iface);
     
    440395*  IShellBrowserImpl_GetControlWindow
    441396*/
    442 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
    443                                               UINT id,
     397HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
     398                                              UINT id,   
    444399                                              HWND *lphwnd)
    445 
     400                                             
    446401{
    447402    ICOM_THIS(IShellBrowserImpl, iface);
     
    456411*/
    457412HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
    458                                                 DWORD grfMode,
     413                                                DWORD grfMode,   
    459414                                                LPSTREAM *ppStrm)
    460 
    461 {
    462     ICOM_THIS(IShellBrowserImpl, iface);
    463 
    464     TRACE("(%p)\n", This);
    465 
    466     /* Feature not implemented */
    467     return E_NOTIMPL;
    468 }
     415                                             
     416{
     417    ICOM_THIS(IShellBrowserImpl, iface);
     418
     419    TRACE("(%p)\n", This);
     420
     421    /* Feature not implemented */
     422    return E_NOTIMPL;
     423}       
    469424/**************************************************************************
    470425*  IShellBrowserImpl_InsertMenusSB
     
    473428                                           HMENU hmenuShared,
    474429                                           LPOLEMENUGROUPWIDTHS lpMenuWidths)
    475 
     430                                             
    476431{
    477432    ICOM_THIS(IShellBrowserImpl, iface);
     
    487442HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
    488443                                                IShellView *ppshv)
    489 
    490 {
    491     ICOM_THIS(IShellBrowserImpl, iface);
    492 
    493     TRACE("(%p)\n", This);
    494 
    495     /* Feature not implemented */
    496     return E_NOTIMPL;
    497 }
     444                                             
     445{
     446    ICOM_THIS(IShellBrowserImpl, iface);
     447
     448    TRACE("(%p)\n", This);
     449
     450    /* Feature not implemented */
     451    return E_NOTIMPL;
     452}   
    498453/**************************************************************************
    499454*  IShellBrowserImpl_QueryActiveShellView
     
    501456HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
    502457                                                  IShellView **ppshv)
    503 
     458                                             
    504459{
    505460    ICOM_THIS(IShellBrowserImpl, iface);
     
    517472    IShellView_AddRef(fodInfos->Shell.FOIShellView);
    518473    return NOERROR;
    519 }
     474}   
    520475/**************************************************************************
    521476*  IShellBrowserImpl_RemoveMenusSB
     
    523478HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
    524479                                           HMENU hmenuShared)
    525 
    526 {
    527     ICOM_THIS(IShellBrowserImpl, iface);
    528 
    529     TRACE("(%p)\n", This);
    530 
    531     /* Feature not implemented */
    532     return E_NOTIMPL;
    533 }
     480                                             
     481{
     482    ICOM_THIS(IShellBrowserImpl, iface);
     483
     484    TRACE("(%p)\n", This);
     485
     486    /* Feature not implemented */
     487    return E_NOTIMPL;
     488}   
    534489/**************************************************************************
    535490*  IShellBrowserImpl_SendControlMsg
    536491*/
    537 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
    538                                             UINT id,
    539                                             UINT uMsg,
    540                                             WPARAM wParam,
     492HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
     493                                            UINT id,   
     494                                            UINT uMsg,   
     495                                            WPARAM wParam,   
    541496                                            LPARAM lParam,
    542497                                            LRESULT *pret)
    543 
     498                                             
    544499{
    545500    ICOM_THIS(IShellBrowserImpl, iface);
    546501    LRESULT lres;
    547 
     502   
    548503    TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
    549504
     
    552507      case FCW_TOOLBAR:
    553508        lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
    554         break;
     509        break;
    555510      default:
    556511        FIXME("ctrl id: %x\n", id);
     
    564519*/
    565520HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
    566                                        HMENU hmenuShared,
     521                                       HMENU hmenuShared,   
    567522                                       HOLEMENU holemenuReserved,
    568523                                       HWND hwndActiveObject)
    569 
    570 {
    571     ICOM_THIS(IShellBrowserImpl, iface);
    572 
    573     TRACE("(%p)\n", This);
    574 
    575     /* Feature not implemented */
    576     return E_NOTIMPL;
    577 }
     524                                             
     525{
     526    ICOM_THIS(IShellBrowserImpl, iface);
     527
     528    TRACE("(%p)\n", This);
     529
     530    /* Feature not implemented */
     531    return E_NOTIMPL;
     532}   
    578533/**************************************************************************
    579534*  IShellBrowserImpl_SetStatusTextSB
     
    581536HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
    582537                                             LPCOLESTR lpszStatusText)
    583 
    584 {
    585     ICOM_THIS(IShellBrowserImpl, iface);
    586 
    587     TRACE("(%p)\n", This);
    588 
    589     /* Feature not implemented */
    590     return E_NOTIMPL;
    591 }
     538                                             
     539{
     540    ICOM_THIS(IShellBrowserImpl, iface);
     541
     542    TRACE("(%p)\n", This);
     543
     544    /* Feature not implemented */
     545    return E_NOTIMPL;
     546}   
    592547/**************************************************************************
    593548*  IShellBrowserImpl_SetToolbarItems
    594549*/
    595550HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
    596                                              LPTBBUTTON lpButtons,
    597                                              UINT nButtons,
     551                                             LPTBBUTTON lpButtons,   
     552                                             UINT nButtons,   
    598553                                             UINT uFlags)
    599 
    600 {
    601     ICOM_THIS(IShellBrowserImpl, iface);
    602 
    603     TRACE("(%p)\n", This);
    604 
    605     /* Feature not implemented */
    606     return E_NOTIMPL;
    607 }
     554                                             
     555{
     556    ICOM_THIS(IShellBrowserImpl, iface);
     557
     558    TRACE("(%p)\n", This);
     559
     560    /* Feature not implemented */
     561    return E_NOTIMPL;
     562}   
    608563/**************************************************************************
    609564*  IShellBrowserImpl_TranslateAcceleratorSB
    610565*/
    611566HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
    612                                                     LPMSG lpmsg,
     567                                                    LPMSG lpmsg,   
    613568                                                    WORD wID)
    614 
     569                                             
    615570{
    616571    ICOM_THIS(IShellBrowserImpl, iface);
     
    630585*/
    631586HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
    632                                             REFIID riid,
     587                                            REFIID riid, 
    633588                                            LPVOID *ppvObj)
    634589{
     
    678633    TRACE("(%p)\n", This);
    679634
    680     fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    681 
     635    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 
     636   
    682637    /* If the selected object is not a folder, send a IDOK command to parent window */
    683     pidl = GetSelectedPidl(ppshv);
    684     if (pidl)
     638    if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
    685639    {
    686640        HRESULT hRes;
     
    688642        ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    689643        IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
    690         if (ulAttr)
    691             hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
    692         /* Tell the dialog that the user selected a file */
     644        if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
     645        {
     646          hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
     647        }
    693648        else
    694         {
    695             hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
    696         }
     649        {
     650          /* Tell the dialog that the user selected a file */
     651          hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
     652        }
    697653
    698654        /* Free memory used by pidl */
     
    715671    _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
    716672
    717     TRACE("(%p)\n", This);
     673    TRACE("(%p shv=%p)\n", This, ppshv);
    718674
    719675    switch (uChange)
     
    721677        case CDBOSC_SETFOCUS:
    722678             /* FIXME: Reset the default button.
    723                 This should be taken care of by defdlg. If control
    724                 other than button receives focus the default button
    725                 should be restored. */
     679                This should be taken care of by defdlg. If control
     680                other than button receives focus the default button
     681                should be restored. */
    726682             SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
     683
    727684            break;
    728         case CDBOSC_KILLFOCUS:
    729             {
    730                 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    731                 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    732                     SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     685        case CDBOSC_KILLFOCUS: 
     686            {
     687                FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     688                if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     689                    SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
    733690            }
    734691            break;
     
    736693            return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
    737694        case CDBOSC_RENAME:
     695            /* nothing to do */
    738696            break;
    739697    }
    740698
    741     return NOERROR;
     699    return NOERROR;     
     700}
     701
     702/* copied from shell32 to avoid linking to it */
     703static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
     704{
     705        TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
     706
     707        switch (src->uType)
     708        {
     709          case STRRET_WSTR:
     710            lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
     711            COMDLG32_SHFree(src->u.pOleStr);
     712            break;
     713
     714          case STRRET_CSTRA:
     715            lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
     716            break;
     717
     718          case STRRET_OFFSETA:
     719            if (pidl)
     720            {
     721              lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
     722            }
     723            break;
     724
     725          default:
     726            FIXME("unknown type!\n");
     727            if (len)
     728            { *(LPSTR)dest = '\0';
     729            }
     730            return(FALSE);
     731        }
     732        return S_OK;
    742733}
    743734/**************************************************************************
    744735*  IShellBrowserImpl_ICommDlgBrowser_IncludeObject
    745736*/
    746 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
     737HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 
    747738                                                               IShellView * ppshv,
    748739                                                               LPCITEMIDLIST pidl)
     
    756747
    757748    TRACE("(%p)\n", This);
    758 //CB: slow!!!
     749
    759750    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    760751
    761752    ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
    762753    IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
    763 
     754   
    764755    if( (ulAttr & SFGAO_HIDDEN)                                         /* hidden */
    765756      | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
    766757        return S_FALSE;
     758
    767759    /* always include directorys and links */
    768     if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
     760    if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 
    769761        return S_OK;
     762
    770763    /* Check if there is a mask to apply if not */
    771     if(!fodInfos->ShellInfos.lpstrCurrentFilter ||
    772        !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
     764    if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
    773765        return S_OK;
    774766
    775     if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_FORPARSING, &str)))
    776     {
    777       if (SUCCEEDED(StrRetToBufW(&str, pidl,szPathW, MAX_PATH)))
     767    if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
     768    {
     769      if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
    778770      {
    779           if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
    780             return S_OK;
     771          if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
     772          return S_OK;
    781773      }
    782774    }
    783775    return S_FALSE;
     776
    784777}
    785778
    786779/**************************************************************************
    787780*  IShellBrowserImpl_ICommDlgBrowser_OnSelChange
    788 */
     781*/ 
    789782HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
    790783{
    791     ULONG             uAttr;
    792784    FileOpenDlgInfos *fodInfos;
    793     UINT              nFiles = 0;                  /* Intial to zero */
    794     UINT              nCurrLength;
    795     UINT              nFileToOpen;
    796     UINT              nAllLength = 2;              /* Include intial '"' and final NULL */
    797     UINT              nSize = MAX_PATH;
    798     UINT              nFileSelected = 0;
    799     LPITEMIDLIST      pidlSelection;
    800     LPSTR             lpstrTemp = NULL;
    801     LPSTR             lpstrAllFile = NULL;
    802     char              lpstrCurrFile[MAX_PATH];
    803785
    804786    _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
    805787
    806788    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    807     TRACE("(%p)\n", This);
    808 
    809     /* Locate memory and Get selected item counter */
    810     if((lpstrAllFile = (LPSTR)SHAlloc(nSize * sizeof(char))) != NULL)
    811     {
    812         ZeroMemory(lpstrAllFile, nSize * sizeof(char));
    813         *lpstrAllFile =  '\"';
    814         lpstrTemp = lpstrAllFile + 1;
    815         nFileSelected = GetNumSelected(fodInfos->Shell.FOIShellView);     /* Get all selected counter */
    816     }
    817 
    818     /* Count all selected files we have */
    819     for(nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
    820     {   /* get the file selected */
    821         pidlSelection = NULL;
    822         uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    823         ZeroMemory(lpstrCurrFile, MAX_PATH * sizeof(char));
    824         EnumSelectedPidls(fodInfos->Shell.FOIShellView, nFileToOpen, &pidlSelection);
    825 
    826         /* get the file name and attrib of the selected files*/
    827         GetName(fodInfos->Shell.FOIShellFolder, pidlSelection, SHGDN_NORMAL, lpstrCurrFile);
    828         IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr);
    829         COMDLG32_SHFree((LPVOID) pidlSelection);
    830 
    831         if(!uAttr)
    832         {   /* Get the new file name */
    833             nCurrLength = lstrlenA(lpstrCurrFile);
    834             if(nAllLength + nCurrLength + 3 > nSize)
    835             {   /* increase the memory and transfer string to new location */
    836                 nSize += MAX_PATH;
    837                 if((lpstrTemp = (LPSTR)SHAlloc(nSize * sizeof(char))) != NULL)
    838                 {   /* Transfer old file names */
    839                     ZeroMemory(lpstrTemp, nSize * sizeof(char));
    840                     lstrcpyA(lpstrTemp, lpstrAllFile);
    841                     SHFree(lpstrAllFile);
    842                     lpstrAllFile = lpstrTemp;
    843                     lpstrTemp = lpstrAllFile + nAllLength - 1;
    844                 }
    845                 else
    846                 {   /* if failure, stop the loop to get filename */
    847                     nFileSelected = 0;
    848                 }
    849             }
    850 
    851             if(lpstrTemp != NULL)
    852             {   /* Add the new file name */
    853                 nFiles++;
    854                 lstrcpyA(lpstrTemp, lpstrCurrFile);
    855                 *(lpstrTemp + nCurrLength) = '\"';
    856                 *(lpstrTemp + nCurrLength + 1) = ' ';
    857                 *(lpstrTemp + nCurrLength + 2) = '\"';
    858                 nAllLength += nCurrLength + 3;
    859                 lpstrTemp = lpstrAllFile + nAllLength - 1;
    860             }
    861         }
    862     }
    863 
    864     if(lpstrAllFile)
    865     {
    866         if(nFiles > 1)
    867         {
    868             *(lpstrTemp - 2) = '\0';
    869             SetWindowTextA(fodInfos->DlgInfos.hwndFileName, lpstrAllFile);
    870         }
    871         else
    872         {
    873             *(lpstrTemp - 3) = '\0';
    874             SetWindowTextA(fodInfos->DlgInfos.hwndFileName, lpstrAllFile + 1);
    875         }
    876 
    877         fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
    878         SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
    879         SHFree( lpstrAllFile );
    880     }
    881     else
    882     {
    883         SetWindowTextA(fodInfos->DlgInfos.hwndFileName, "");
    884     }
    885 
    886     if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    887         SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner, IDOK, "&Save");
    888     else
    889         SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner, IDOK, "&Open");
    890 
    891     fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
    892 
    893     return nFileSelected ? S_OK : E_FAIL;
    894 }
    895 
    896 /***********************************************************************
    897  *          GetSelectedPidl
    898  *
    899  * Return the pidl of the first selected item in the view
    900  */
    901 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv)
    902 {
    903 
    904     IDataObject *doSelected;
    905     LPITEMIDLIST pidlSelected = NULL;
    906 
    907     TRACE("sv=%p\n", ppshv);
    908 
    909     /* Get an IDataObject from the view */
    910     if(SUCCEEDED(IShellView_GetItemObject(ppshv,
    911                                           SVGIO_SELECTION,
    912                                           &IID_IDataObject,
    913                                           (LPVOID *)&doSelected)))
    914     {
    915         STGMEDIUM medium;
    916         FORMATETC formatetc;
    917 
    918         /* Set the FORMATETC structure*/
    919         SETDefFormatEtc(formatetc,
    920                         RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
    921                         TYMED_HGLOBAL);
    922 
    923         /* Get the pidl from IDataObject */
    924         if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
    925         {
    926             LPIDA cida = GlobalLock(medium.u.hGlobal);
    927             TRACE("cida=%p\n", cida);
    928             pidlSelected =  COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));
    929 
    930             if(medium.pUnkForRelease)
    931                 IUnknown_Release(medium.pUnkForRelease);
    932             else
    933             {
    934               GlobalUnlock(medium.u.hGlobal);
    935               GlobalFree(medium.u.hGlobal);
    936             }
    937         }
    938         IDataObject_Release(doSelected);
    939         return pidlSelected;
    940     }
    941 
    942     return NULL;
    943 }
    944 
    945 /***********************************************************************
    946  *          EnumSelectedPidls
    947  *
    948  * Return the pidl(s) of the selected item(s) in the view.
    949  *
    950 */
    951 BOOL EnumSelectedPidls( IShellView *ppshv,  /*[in]*/
    952                         UINT nPidlIndex,  /*[in]*/
    953                         LPITEMIDLIST *pidlSelected /*[out]*/ )
    954 {
    955 
    956     IDataObject *doSelected;
    957     BOOL retVal = TRUE;
    958 
    959     /* Get an IDataObject from the view */
    960     if(SUCCEEDED(IShellView_GetItemObject(ppshv,
    961                                           SVGIO_SELECTION,
    962                                           &IID_IDataObject,
    963                                           (LPVOID *)&doSelected)))
    964     {
    965         STGMEDIUM medium;
    966         FORMATETC formatetc;
    967 
    968         /* Set the FORMATETC structure*/
    969         SETDefFormatEtc(formatetc,
    970                         RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
    971                         TYMED_HGLOBAL);
    972 
    973         /* Get the pidls from IDataObject */
    974         if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
    975         {
    976             LPIDA cida = GlobalLock(medium.u.hGlobal);
    977             if(nPidlIndex < cida->cidl)
    978             {
    979                 *pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex + 1]]));
    980             }
    981             else
    982             {
    983                 retVal = FALSE;
    984             }
    985 
    986             if(medium.pUnkForRelease)
    987             {
    988                 IUnknown_Release(medium.pUnkForRelease);
    989             }
    990             else
    991             {
    992                 GlobalUnlock(medium.u.hGlobal);
    993                 GlobalFree(medium.u.hGlobal);
    994             }
    995         }
    996         IDataObject_Release(doSelected);
    997         return retVal;
    998     }
    999     return FALSE;
    1000 }
    1001 
    1002 /***********************************************************************
    1003  *          GetNumSelected
    1004  *
    1005  * Return the number of selected items in the view.
    1006  *
    1007 */
    1008 UINT GetNumSelected( IShellView *ppshv )
    1009 {
    1010     IDataObject *doSelected;
    1011     UINT retVal = 0;
    1012 
    1013        /* Get an IDataObject from the view */
    1014     if(SUCCEEDED(IShellView_GetItemObject(ppshv,
    1015                                           SVGIO_SELECTION,
    1016                                           &IID_IDataObject,
    1017                                           (LPVOID *)&doSelected)))
    1018     {
    1019         STGMEDIUM medium;
    1020         FORMATETC formatetc;
    1021 
    1022         /* Set the FORMATETC structure*/
    1023         SETDefFormatEtc(formatetc,
    1024                         RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
    1025                         TYMED_HGLOBAL);
    1026 
    1027         /* Get the pidls from IDataObject */
    1028         if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
    1029         {
    1030             LPIDA cida = GlobalLock(medium.u.hGlobal);
    1031             retVal = cida->cidl;
    1032 
    1033             if(medium.pUnkForRelease)
    1034                 IUnknown_Release(medium.pUnkForRelease);
    1035             else
    1036             {
    1037                 GlobalUnlock(medium.u.hGlobal);
    1038                 GlobalFree(medium.u.hGlobal);
    1039             }
    1040         }
    1041         IDataObject_Release(doSelected);
    1042         return retVal;
    1043     }
    1044 
    1045     return 0;
    1046 }
    1047 
    1048 
    1049 
     789    TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView);
     790   
     791    /* release old selections */
     792    if (fodInfos->Shell.FOIDataObject)
     793      IDataObject_Release(fodInfos->Shell.FOIDataObject);
     794   
     795    /* get a new DataObject from the ShellView */
     796    if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
     797                              &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
     798      return E_FAIL;
     799                                         
     800    FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
     801
     802    SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
     803    return S_OK;
     804}
     805
  • trunk/src/comdlg32/filedlgbrowser.h

    r3243 r4511  
    11/*
    22 *  Implementation of IShellBrowser for the File Open common dialog
     3 *
    34 *
    4  *  Corel WINE 20000324 level
    55 */
    66
     
    2121
    2222#define FODPROP_SAVEDLG 0x0001  /* File dialog is a Save file dialog */
    23 #define FODPROP_USEVIEW 0x0002  /* Indicates the user selection must be taken
    24                                    from the IShellView */
     23#define FODPROP_USEVIEW 0x0002  /* Indicates the user selection must be taken 
     24                                   from the IShellView */
    2525
    2626/***********************************************************************
     
    4141typedef struct
    4242{
    43 
     43   
    4444    LPOPENFILENAMEA ofnInfos;
    4545    struct {
    46         IShellBrowser *FOIShellBrowser;
     46        IShellBrowser *FOIShellBrowser; 
    4747        IShellFolder *FOIShellFolder;
    4848        IShellView *FOIShellView;
     49        IDataObject *FOIDataObject;
    4950    } Shell;
    5051
     
    6263        HWND hwndLookInCB;
    6364        HWND hwndFileName;
    64         HWND hwndTB;
     65        HWND hwndTB;
    6566        HWND hwndCustomDlg;
    66         DWORD dwDlgProp;
     67        DWORD dwDlgProp;
    6768    } DlgInfos;
    6869
     
    7273 * Control ID's
    7374 */
     75#define IDS_ABOUTBOX                    101
     76#define IDS_DOCUMENTFOLDERS             102
     77#define IDS_PERSONAL                    103
     78#define IDS_FAVORITES                   104
     79#define IDS_PATH                        105
     80#define IDS_DESKTOP                     106
     81
     82#define IDS_FONTS                       108
     83#define IDS_MYCOMPUTER                  110
     84#define IDS_SYSTEMFOLDERS               112
     85#define IDS_LOCALHARDRIVES              113
    7486#define IDS_FILENOTFOUND                114
    7587#define IDS_VERIFYFILE                  115
     
    7789#define IDS_CREATEFOLDER_DENIED         117
    7890#define IDS_FILEOPEN_CAPTION            118
     91#define IDL_OVERWRITEFILE               119
     92#define IDS_INVALID_FILENAME_TITLE      120
     93#define IDS_INVALID_FILENAME            121
     94#define IDS_PATHNOTEXISTING             122
     95#define IDS_FILENOTEXISTING             123
    7996
    8097/* File Dialog Tooltips string IDs */
     
    84101#define IDS_LISTVIEW                    152
    85102#define IDS_REPORTVIEW                  153
     103#define IDS_TODESKTOP                   154
    86104
    87105#define IDC_OPENREADONLY                chx1
    88106
    89 #define IDC_TOOLBARSTATIC               stc1
     107#define IDC_TOOLBARSTATIC               stc1
    90108#define IDC_FILETYPESTATIC              stc2
    91109#define IDC_FILENAMESTATIC              stc3
     
    99117#define IDC_FILENAME                    edt1
    100118
    101 #define IDC_TOOLBAR                     ctl1
     119#define IDC_TOOLBAR                     ctl1
    102120
    103121/***********************************************************************
     
    109127/* IUnknown */
    110128HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
    111                                             REFIID riid,
     129                                            REFIID riid, 
    112130                                            LPVOID *ppvObj);
    113131
     
    117135
    118136/* IOleWindow */
    119 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
     137HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
    120138                                           HWND * phwnd);
    121139
     
    125143/* IShellBrowser */
    126144
    127 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
    128                                           LPCITEMIDLIST pidl,
     145HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 
     146                                          LPCITEMIDLIST pidl,   
    129147                                          UINT wFlags);
    130148
    131 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
     149HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
    132150                                              BOOL fEnable);
    133 
    134 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
    135                                               UINT id,
     151                                             
     152HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
     153                                              UINT id,   
    136154                                              HWND *lphwnd);
    137155
    138156HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
    139                                                 DWORD grfMode,
     157                                                DWORD grfMode,   
    140158                                                LPSTREAM *ppStrm);
    141159
     
    146164HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
    147165                                                IShellView *ppshv);
    148 
     166                                             
    149167
    150168HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
     
    154172                                           HMENU hmenuShared);
    155173
    156 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
    157                                             UINT id,
    158                                             UINT uMsg,
    159                                             WPARAM wParam,
     174HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
     175                                            UINT id,   
     176                                            UINT uMsg,   
     177                                            WPARAM wParam,   
    160178                                            LPARAM lParam,
    161179                                            LRESULT *pret);
    162180
    163181HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
    164                                        HMENU hmenuShared,
     182                                       HMENU hmenuShared,   
    165183                                       HOLEMENU holemenuReserved,
    166184                                       HWND hwndActiveObject);
     
    168186HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
    169187                                             LPCOLESTR lpszStatusText);
    170 
     188                                               
    171189
    172190HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
    173                                              LPTBBUTTON lpButtons,
    174                                              UINT nButtons,
     191                                             LPTBBUTTON lpButtons,   
     192                                             UINT nButtons,   
    175193                                             UINT uFlags);
    176 
     194                                             
    177195HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
    178                                                     LPMSG lpmsg,
     196                                                    LPMSG lpmsg,   
    179197                                                    WORD wID);
    180198
     
    183201
    184202HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
    185                                             REFIID riid,
     203                                            REFIID riid, 
    186204                                            LPVOID *ppvObj);
    187205
     
    197215                                                               ULONG uChange);
    198216
    199 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
     217HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 
    200218                                                               IShellView * ppshv,
    201219                                                               LPCITEMIDLIST pidl);
    202220
    203221
    204 
    205 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
    206 BOOL EnumSelectedPidls(IShellView *ppshv, UINT nPidlIndex, LPITEMIDLIST *pidlSelected);
    207 UINT GetNumSelected(IShellView *ppshv);
     222LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex);
     223UINT GetNumSelected(IDataObject *doSelected);
     224
     225/* pidl handling */
     226BOOL IsPidlFolder (LPSHELLFOLDER psf, LPITEMIDLIST pidl);
     227
     228/* Functions used by the EDIT box */
     229void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd);
     230int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPSTR * lpstrFileList, UINT * sizeUsed);
    208231
    209232#endif /*SHBROWSER_H*/
  • trunk/src/comdlg32/filetitle.c

    r3924 r4511  
    1 /* $Id: filetitle.c,v 1.3 2000-08-02 15:11:59 bird Exp $ */
    21/*
    32 * COMMDLG - File Dialogs
     
    54 * Copyright 1994 Martin Ayotte
    65 * Copyright 1996 Albrecht Kleine
    7  *
    8  * Corel WINE 20000324 level
    96 */
    107
     
    1613#include "debugtools.h"
    1714
    18 #include "heap.h"       /* Has to go */
     15#include "heap.h"       /* Has to go */
    1916
    2017DEFAULT_DEBUG_CHANNEL(commdlg)
     
    2219#include "cdlg.h"
    2320
    24 #ifdef __WIN32OS2__
    25 #include <misc.h>
    26 #endif
    27 
    2821/***********************************************************************
    29  *      GetFileTitleA           (COMDLG32.8)
     22 *      GetFileTitleA           (COMDLG32.8)
    3023 *
    3124 */
    3225short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
    3326{
    34         int i, len;
     27        int i, len;
    3528
    36         TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);
     29        TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);
    3730
    38         if(lpFile == NULL || (lpTitle == NULL))
    39                 return -1;
     31        if(lpFile == NULL || lpTitle == NULL)
     32                return -1;
    4033
    41         len = strlen(lpFile);
     34        len = strlen(lpFile);
    4235
    43         if (len == 0)
    44                 return -1;
     36        if (len == 0)
     37                return -1;
    4538
    46         if(strpbrk(lpFile, "*[]"))
    47                 return -1;
     39        if(strpbrk(lpFile, "*[]"))
     40                return -1;
    4841
    49         len--;
     42        len--;
    5043
    51         if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
    52                 return -1;
     44        if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
     45                return -1;
    5346
    54         for(i = len; i >= 0; i--)
    55         {
    56                 if (lpFile[i] == '/' ||  lpFile[i] == '\\' ||  lpFile[i] == ':')
    57                 {
    58                         i++;
    59                         break;
    60                 }
    61         }
     47        for(i = len; i >= 0; i--)
     48        {
     49                if (lpFile[i] == '/' ||  lpFile[i] == '\\' ||  lpFile[i] == ':')
     50                {
     51                        i++;
     52                        break;
     53                }
     54        }
    6255
    63         if(i == -1)
    64                 i++;
     56        if(i == -1)
     57                i++;
    6558
    66         TRACE("---> '%s' \n", &lpFile[i]);
     59        TRACE("---> '%s' \n", &lpFile[i]);
     60   
     61        len = strlen(lpFile+i)+1;
     62        if(cbBuf < len)
     63                return len;
    6764
    68         len = strlen(lpFile+i)+1;
    69         if(cbBuf < len)
    70                 return len;
    71 
    72         strncpy(lpTitle,&lpFile[i],len);
    73         return 0;
     65        strncpy(lpTitle, &lpFile[i], len);
     66        return 0;
    7467}
    7568
    7669
    7770/***********************************************************************
    78  *      GetFileTitleW           (COMDLG32.9)
     71 *      GetFileTitleW           (COMDLG32.9)
    7972 *
    8073 */
    8174short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf)
    8275{
    83         LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);      /* Has to go */
    84         LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);
    85         short   ret;
     76        LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);      /* Has to go */
     77        LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);
     78        short   ret;
    8679
    87         ret = GetFileTitleA(file, title, cbBuf);
     80        ret = GetFileTitleA(file, title, cbBuf);
    8881
    89         lstrcpynAtoW(lpTitle, title, cbBuf);
    90         HeapFree(GetProcessHeap(), 0, file);
    91         HeapFree(GetProcessHeap(), 0, title);
    92         return ret;
     82        lstrcpynAtoW(lpTitle, title, cbBuf);
     83        HeapFree(GetProcessHeap(), 0, file);
     84        HeapFree(GetProcessHeap(), 0, title);
     85        return ret;
    9386}
    9487
    9588
     89#ifndef __WIN32OS2__
    9690/***********************************************************************
    97  *      GetFileTitle16          (COMMDLG.27)
     91 *      GetFileTitle16          (COMMDLG.27)
    9892 */
    9993short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf)
    10094{
    101         return GetFileTitleA(lpFile, lpTitle, cbBuf);
     95        return GetFileTitleA(lpFile, lpTitle, cbBuf);
    10296}
     97#endif
    10398
  • trunk/src/comdlg32/makefile

    r3864 r4511  
    1 # $Id: makefile,v 1.18 2000-07-19 19:05:05 sandervl Exp $
     1# $Id: makefile,v 1.19 2000-10-21 18:42:17 sandervl Exp $
    22
    33#
     
    2424# Object files. All objects should be prefixed with $(OBJDIR)!
    2525OBJS = \
    26 $(OBJDIR)\comdlg32.obj \
     26$(OBJDIR)\colordlg.obj \
     27$(OBJDIR)\fontdlg.obj \
    2728$(OBJDIR)\initterm.obj \
    2829$(OBJDIR)\cdlg32.obj \
     30$(OBJDIR)\filetitle.obj \
    2931$(OBJDIR)\finddlg32.obj \
    3032$(OBJDIR)\filedlg95.obj \
     33$(OBJDIR)\comdlg32.obj \
    3134$(OBJDIR)\filedlgbrowser.obj \
    32 $(OBJDIR)\filetitle.obj \
    3335$(OBJDIR)\comdlgguid.obj \
    3436$(OBJDIR)\rsrc.obj
  • trunk/src/comdlg32/rsrc.orc

    r3243 r4511  
    1 /* $Id: rsrc.orc,v 1.3 2000-03-26 16:31:45 cbratschi Exp $ */
    21/*
    32 * Top level resource file for Common Dialogs
     
    54 */
    65
     6#include "windef.h"
    77#include "winuser.h"
    88#include "winnls.h"
     
    2626 * get localized bitmaps for example.
    2727 */
    28 
    29 /* TODO TODO FIXME
    30  * The localized resources have be pulled out due to
    31  * the time required to move some strings from here to
    32  * shell32.dll.  This is something to deal with
    33  * after release
    34  */
    35 #if 0
    3628#include "cdlg_Ca.orc"
    3729#include "cdlg_Cs.orc"
    3830#include "cdlg_Da.orc"
    3931#include "cdlg_De.orc"
    40 #endif
    4132#include "cdlg_En.orc"
    42 #if 0
    4333#include "cdlg_Eo.orc"
    4434#include "cdlg_Es.orc"
     
    5343#include "cdlg_Pt.orc"
    5444#include "cdlg_Ru.orc"
     45#include "cdlg_Sk.orc"
    5546#include "cdlg_Sv.orc"
    5647#include "cdlg_Wa.orc"
    57 #endif
     48#include "cdlg_Ja.orc"
Note: See TracChangeset for help on using the changeset viewer.