Changeset 1556 for trunk/src


Ignore:
Timestamp:
Nov 2, 1999, 9:37:43 PM (26 years ago)
Author:
sandervl
Message:

Wine 991031 update

Location:
trunk/src/comdlg32
Files:
6 edited

Legend:

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

    r1548 r1556  
    1 /* $Id: cdlg.h,v 1.1 1999-11-02 19:09:41 sandervl Exp $ */
     1/* $Id: cdlg.h,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */
    22/*
    3  *  Common Dialog Boxes interface (32 bit) (990815)
     3 *  Common Dialog Boxes interface (32 bit)
    44 *
    55 * Copyright 1998 Bertho A. Stultiens
     
    3737
    3838#define PD32_PRINT_TITLE        7000
    39 #define PD32_PRINT_ALL_X_PAGES  7001
    40 #define PD32_INVALID_PAGE_RANGE 7003
     39
     40#define PD32_VALUE_UREADABLE                  1104
     41#define PD32_INVALID_PAGE_RANGE               1105
     42#define PD32_FROM_NOT_ABOVE_TO                1106
     43#define PD32_MARGINS_OVERLAP                  1107
     44#define PD32_NR_OF_COPIES_EMPTY               1108
     45#define PD32_TOO_LARGE_COPIES                 1109
     46#define PD32_PRINT_ERROR                      1110
     47#define PD32_NO_DEFAULT_PRINTER               1111
     48#define PD32_CANT_FIND_PRINTER                1112
     49#define PD32_OUT_OF_MEMORY                    1113
     50#define PD32_GENERIC_ERROR                    1114
     51#define PD32_DRIVER_UNKNOWN                   1115
     52
     53#define PD32_PRINTER_STATUS_READY             1536
     54#define PD32_PRINTER_STATUS_PAUSED            1537
     55#define PD32_PRINTER_STATUS_ERROR             1538
     56#define PD32_PRINTER_STATUS_PENDING_DELETION  1539
     57#define PD32_PRINTER_STATUS_PAPER_JAM         1540
     58#define PD32_PRINTER_STATUS_PAPER_OUT         1541
     59#define PD32_PRINTER_STATUS_MANUAL_FEED       1542
     60#define PD32_PRINTER_STATUS_PAPER_PROBLEM     1543
     61#define PD32_PRINTER_STATUS_OFFLINE           1544
     62#define PD32_PRINTER_STATUS_IO_ACTIVE         1545
     63#define PD32_PRINTER_STATUS_BUSY              1546
     64#define PD32_PRINTER_STATUS_PRINTING          1547
     65#define PD32_PRINTER_STATUS_OUTPUT_BIN_FULL   1548
     66#define PD32_PRINTER_STATUS_NOT_AVAILABLE     1549
     67#define PD32_PRINTER_STATUS_WAITING           1550
     68#define PD32_PRINTER_STATUS_PROCESSING        1551
     69#define PD32_PRINTER_STATUS_INITIALIZING      1552
     70#define PD32_PRINTER_STATUS_WARMING_UP        1553
     71#define PD32_PRINTER_STATUS_TONER_LOW         1554
     72#define PD32_PRINTER_STATUS_NO_TONER          1555
     73#define PD32_PRINTER_STATUS_PAGE_PUNT         1556
     74#define PD32_PRINTER_STATUS_USER_INTERVENTION 1557
     75#define PD32_PRINTER_STATUS_OUT_OF_MEMORY     1558
     76#define PD32_PRINTER_STATUS_DOOR_OPEN         1559
     77#define PD32_PRINTER_STATUS_SERVER_UNKNOWN    1560
     78#define PD32_PRINTER_STATUS_POWER_SAVE        1561
     79
     80#define PD32_DEFAULT_PRINTER                  1582
     81#define PD32_NR_OF_DOCUMENTS_IN_QUEUE         1583
     82#define PD32_PRINT_ALL_X_PAGES                1584
     83#define PD32_MARGINS_IN_INCHES                1585
     84#define PD32_MARGINS_IN_MILIMETERS            1586
     85#define PD32_MILIMETERS                       1587
    4186
    4287#include "commctrl.h"
    43 extern HDPA     (* WINAPI COMDLG32_DPA_Create) (INT); 
    44 extern LPVOID   (* WINAPI COMDLG32_DPA_GetPtr) (const HDPA, INT);   
    45 extern LPVOID   (* WINAPI COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa);
    46 extern LPVOID   (* WINAPI COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i);
    47 extern INT      (* WINAPI COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID);
    48 extern BOOL     (* WINAPI COMDLG32_DPA_Destroy) (const HDPA);
     88#include "wine/undocshell.h"
     89#include "shellapi.h"
    4990
    50 extern HICON    (* WINAPI COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT);
    51 extern HIMAGELIST (* WINAPI COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT);
    52 extern BOOL     (* WINAPI COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
    53 extern BOOL     (* WINAPI COMDLG32_ImageList_Destroy) (HIMAGELIST himl);
     91/* DPA */
     92extern HDPA     (WINAPI* COMDLG32_DPA_Create) (INT); 
     93extern LPVOID   (WINAPI* COMDLG32_DPA_GetPtr) (const HDPA, INT);   
     94extern LPVOID   (WINAPI* COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa);
     95extern LPVOID   (WINAPI* COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i);
     96extern INT      (WINAPI* COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID);
     97extern BOOL     (WINAPI* COMDLG32_DPA_Destroy) (const HDPA);
     98
     99/* IMAGELIST */
     100extern HICON    (WINAPI* COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT);
     101extern HIMAGELIST (WINAPI *COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT);
     102extern BOOL     (WINAPI* COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
     103extern BOOL     (WINAPI* COMDLG32_ImageList_Destroy) (HIMAGELIST himl);
     104
     105/* ITEMIDLIST */
     106
     107extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST);
     108extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
     109extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST);
     110extern BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST);
     111extern BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
     112
     113/* SHELL */
     114extern BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
     115extern HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
     116extern DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **);
     117extern DWORD    (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT);
     118extern DWORD (WINAPI *COMDLG32_SHFree)(LPVOID);
     119
     120/* PATH */
     121extern BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x);
     122extern LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path);
     123extern DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
     124extern BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
     125extern LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path);
    54126#endif
    55127
  • trunk/src/comdlg32/cdlg32.cpp

    r1548 r1556  
    1 /* $Id: cdlg32.cpp,v 1.1 1999-11-02 19:09:41 sandervl Exp $ */
     1/* $Id: cdlg32.cpp,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */
    22/*
    3  *  Common Dialog Boxes interface (32 bit) (990815)
    4  *  Find/Replace 
     3 *  Common Dialog Boxes interface (32 bit)
     4 *  Find/Replace
    55 *
    66 * Copyright 1999 Bertho A. Stultiens
    77 */
    88
     9#ifdef __WIN32OS2__
     10// ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error
     11#define CINTERFACE 1
    912#include <os2win.h>
     13#else
     14#include "winbase.h"
     15#endif
    1016#include "commdlg.h"
    1117#include "cderr.h"
     
    1622#include "cdlg.h"
    1723
     24
    1825HINSTANCE       COMDLG32_hInstance = 0;
    19 HINSTANCE16     COMDLG32_hInstance16 = 0;
    2026
    2127static DWORD    COMDLG32_TlsIndex;
     
    2531HINSTANCE       SHELL32_hInstance = 0;
    2632
    27 HDPA    (* WINAPI COMDLG32_DPA_Create) (INT); 
    28 LPVOID  (* WINAPI COMDLG32_DPA_GetPtr) (const HDPA, INT);   
    29 LPVOID  (* WINAPI COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa);
    30 LPVOID  (* WINAPI COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i);
    31 INT     (* WINAPI COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID);
    32 BOOL    (* WINAPI COMDLG32_DPA_Destroy) (const HDPA);
    33 
    34 HICON   (* WINAPI COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT);
    35 HIMAGELIST (* WINAPI COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT);
    36 BOOL    (* WINAPI COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
    37 BOOL    (* WINAPI COMDLG32_ImageList_Destroy) (HIMAGELIST himl);
     33/* DPA */
     34HDPA    (WINAPI* COMDLG32_DPA_Create) (INT); 
     35LPVOID  (WINAPI* COMDLG32_DPA_GetPtr) (const HDPA, INT);   
     36LPVOID  (WINAPI* COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i);
     37LPVOID  (WINAPI* COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa);
     38INT     (WINAPI* COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID);
     39BOOL    (WINAPI* COMDLG32_DPA_Destroy) (const HDPA);
     40
     41/* IMAGELIST */
     42HICON   (WINAPI* COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT);
     43HIMAGELIST (WINAPI *COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT);
     44BOOL    (WINAPI* COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
     45BOOL    (WINAPI* COMDLG32_ImageList_Destroy) (HIMAGELIST himl);
     46
     47/* ITEMIDLIST */
     48LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST);
     49LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
     50LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST);
     51BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST);
     52BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
     53
     54/* SHELL */
     55BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
     56HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
     57DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **);
     58DWORD   (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT);
     59DWORD (WINAPI *COMDLG32_SHFree)(LPVOID);
     60
     61/* PATH */
     62BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x);
     63LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path);
     64DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
     65BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
     66LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path);
    3867
    3968/***********************************************************************
     
    4877BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
    4978{
    50 //      TRACE("(%08x, %08lx, %p)\n", hInstance, Reason, Reserved);
     79        TRACE("(%08x, %08lx, %p)\n", hInstance, Reason, Reserved);
    5180
    5281        switch(Reason)
     
    5685                if(COMDLG32_hInstance)
    5786                {
    58                         dprintf(("comdlg32.dll instantiated twice in one address space!\n"));
     87                        ERR("comdlg32.dll instantiated twice in one address space!\n");
    5988                        /*
    6089                         * We should return FALSE here, but that will break
     
    7099                if((COMDLG32_TlsIndex = TlsAlloc()) == 0xffffffff)
    71100                {
    72                         dprintf(("No space for COMDLG32 TLS\n"));
     101                        ERR("No space for COMDLG32 TLS\n");
    73102                        return FALSE;
    74103                }
     
    79108                if (!COMCTL32_hInstance || !SHELL32_hInstance)
    80109                {
    81                         dprintf(("loading of comctl32 or shell32 failed\n"));
     110                        ERR("loading of comctl32 or shell32 or shlwapi failed\n");
    82111                        return FALSE;
    83112                }
    84 
     113                /* DPA */
    85114                *(VOID **)&COMDLG32_DPA_Create=(void*)GetProcAddress(COMCTL32_hInstance, (LPCSTR)328L);
    86115                *(VOID **)&COMDLG32_DPA_Destroy=(void*)GetProcAddress(COMCTL32_hInstance, (LPCSTR)329L);
     
    90119                *(VOID **)&COMDLG32_DPA_DeleteAllPtrs=(void*)GetProcAddress(COMCTL32_hInstance, (LPCSTR)337L);
    91120
     121                /* IMAGELIST */
    92122                *(VOID **)&COMDLG32_ImageList_GetIcon=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_GetIcon");
    93123                *(VOID **)&COMDLG32_ImageList_LoadImageA=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_LoadImageA");
    94124                *(VOID **)&COMDLG32_ImageList_Draw=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_Draw");
    95125                *(VOID **)&COMDLG32_ImageList_Destroy=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_Destroy");
     126               
     127                /* ITEMISLIST */
     128               
     129                *(VOID **)&COMDLG32_PIDL_ILIsEqual =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)21L);
     130                *(VOID **)&COMDLG32_PIDL_ILCombine =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)25L);
     131                *(VOID **)&COMDLG32_PIDL_ILGetNext =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)153L);
     132                *(VOID **)&COMDLG32_PIDL_ILClone =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)18L);
     133                *(VOID **)&COMDLG32_PIDL_ILRemoveLastID =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)17L);
     134               
     135                /* SHELL */
     136               
     137                *(VOID **)&COMDLG32_SHFree = (void*)GetProcAddress(SHELL32_hInstance,"SHFree");
     138                *(VOID **)&COMDLG32_SHGetSpecialFolderLocation = (void*)GetProcAddress(SHELL32_hInstance,"SHGetSpecialFolderLocation");
     139                *(VOID **)&COMDLG32_SHGetPathFromIDListA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetPathFromIDListA");
     140                *(VOID **)&COMDLG32_SHGetDesktopFolder = (void*)GetProcAddress(SHELL32_hInstance,"SHGetDesktopFolder");
     141                *(VOID **)&COMDLG32_SHGetFileInfoA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetFileInfoA");
     142
     143                /* ### WARINIG ###
     144                We can't do a GetProcAddress to link to  StrRetToBuf[A|W] sine not all
     145                versions of the shlwapi are exporting these functions. When we are
     146                seperating the dlls then we have to dublicate code from shell32 into comdlg32.
     147                Till then just call these functions. These functions don't have any side effects
     148                so it won't break the use of any combination of native and buildin dll's (jsch) */
     149
     150                /* PATH */
     151                *(VOID **)&COMDLG32_PathMatchSpecW = (void*)GetProcAddress(SHELL32_hInstance,"PathMatchSpecW");
     152                *(VOID **)&COMDLG32_PathIsRootA = (void*)GetProcAddress(SHELL32_hInstance,"PathIsRootA");
     153                *(VOID **)&COMDLG32_PathRemoveFileSpecA = (void*)GetProcAddress(SHELL32_hInstance,"PathRemoveFileSpecA");
     154                *(VOID **)&COMDLG32_PathFindFilenameA = (void*)GetProcAddress(SHELL32_hInstance,"PathFindFileNameA");
     155                *(VOID **)&COMDLG32_PathAddBackslashA = (void*)GetProcAddress(SHELL32_hInstance,"PathAddBackslashA");
    96156                break;
    97157
     
    138198void COMDLG32_SetCommDlgExtendedError(DWORD err)
    139199{
     200        TRACE("(%08lx)\n", err);
    140201        TlsSetValue(COMDLG32_TlsIndex, (void *)err);
    141202}
  • trunk/src/comdlg32/comdlg32.cpp

    r1548 r1556  
    1 /* $Id: comdlg32.cpp,v 1.16 1999-11-02 19:09:42 sandervl Exp $ */
     1/* $Id: comdlg32.cpp,v 1.17 1999-11-02 20:37:42 sandervl Exp $ */
    22
    33/*
     
    7676 *****************************************************************************/
    7777
    78 ODINFUNCTION1(BOOL, GetSaveFileNameA32,
     78ODINFUNCTION1(BOOL, GetSaveFileNameA,
    7979              LPOPENFILENAMEA, lpofn)
    8080{
     
    102102 *****************************************************************************/
    103103
    104 ODINFUNCTION1(BOOL, GetSaveFileNameW32,
     104ODINFUNCTION1(BOOL, GetSaveFileNameW,
    105105              LPOPENFILENAMEW, lpofn)
    106106{
     
    225225 *****************************************************************************/
    226226
    227 ODINFUNCTION1(BOOL, GetOpenFileNameA32,
     227ODINFUNCTION1(BOOL, GetOpenFileNameA,
    228228              LPOPENFILENAMEA, lpofn)
    229229{
     
    250250 *****************************************************************************/
    251251
    252 ODINFUNCTION1(BOOL, GetOpenFileNameW32,
     252ODINFUNCTION1(BOOL, GetOpenFileNameW,
    253253              LPOPENFILENAMEW, lpofn)
    254254{
  • trunk/src/comdlg32/comdlg32.def

    r1548 r1556  
    1 ; $Id: comdlg32.def,v 1.3 1999-11-02 19:09:42 sandervl Exp $
     1; $Id: comdlg32.def,v 1.4 1999-11-02 20:37:42 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    1515    GetFileTitleA              = _GetFileTitleA32@12           @8
    1616    GetFileTitleW              = _GetFileTitleW32@12           @9
    17     GetOpenFileNameA           = _GetOpenFileNameA32@4         @10
    18     GetOpenFileNameW           = _GetOpenFileNameW32@4         @11
    19     GetSaveFileNameA           = _GetSaveFileNameA32@4         @12
    20     GetSaveFileNameW           = _GetSaveFileNameW32@4         @13
     17    GetOpenFileNameA           = _GetOpenFileNameA@4         @10
     18    GetOpenFileNameW           = _GetOpenFileNameW@4         @11
     19    GetSaveFileNameA           = _GetSaveFileNameA@4         @12
     20    GetSaveFileNameW           = _GetSaveFileNameW@4         @13
    2121    PageSetupDlgA              = _PageSetupDlgA@4            @14
    2222    PageSetupDlgW              = _PageSetupDlgW@4            @15
  • trunk/src/comdlg32/filedlg95.cpp

    r1548 r1556  
    1 /* $Id: filedlg95.cpp,v 1.1 1999-11-02 19:09:42 sandervl Exp $ */
     1/* $Id: filedlg95.cpp,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */
    22/*
    3  * COMMDLG - File Open Dialogs Win95 look and feel (990815)
    4  *
    5  */
    6 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error
    7 #define CINTERFACE 1
    8 
     3 * COMMDLG - File Open Dialogs Win95 look and feel
     4 *
     5 */
    96#include <ctype.h>
    107#include <stdlib.h>
    118#include <string.h>
     9#ifdef __WIN32OS2__
     10// ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error
     11#define CINTERFACE 1
    1212#include <os2win.h>
     13#else
     14#include "winbase.h"
     15#include "tweak.h"
     16#endif
    1317#include "ldt.h"
    1418#include "heap.h"
    1519#include "commdlg.h"
    1620#include "dlgs.h"
     21#include "cdlg.h"
    1722#include "debugtools.h"
    1823#include "cderr.h"
    19 //#include "tweak.h"
    2024#include "winnls.h"
    2125#include "shellapi.h"
    22 #include "commctrl.h"
    2326#include "tchar.h"
    2427#include "filedlgbrowser.h"
    25 #include "wine/undocshell.h"
    2628#include "wine/obj_contextmenu.h"
    2729
     30#ifdef __WIN32OS2__
     31#include <heapstring.h>
     32
     33#define MapHModuleSL(a) a
     34#define MapHModuleLS(a) a
     35#endif
     36
    2837DEFAULT_DEBUG_CHANNEL(commdlg)
    2938
    30 #include "cdlg.h"
    31 
    32 #include <heapstring.h>
    3339
    3440/***********************************************************************
     
    105111#define CBShowDropDown(hwnd,show) \
    106112  SendMessageA(hwnd,CB_SHOWDROPDOWN,(WPARAM)show,0);
     113#define CBSetItemHeight(hwnd,index,height) \
     114  SendMessageA(hwnd,CB_SETITEMHEIGHT,(WPARAM)index,(LPARAM)height);
    107115
    108116
     
    129137static BOOL    FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb);
    130138static BOOL    FILEDLG95_SHELL_NewFolder(HWND hwnd);
    131        BOOL    FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
    132                                                         LPITEMIDLIST pidlCurrentFolder,
    133                                                         LPSTR lpstrMask);
    134139static void    FILEDLG95_SHELL_Clean(HWND hwnd);
     140
    135141/* Functions used by the filetype combo box */
    136142static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd);
     
    159165/* Shell memory allocation */
    160166char *MemAlloc(UINT size);
    161 void  MemFree(void *mem);
     167void MemFree(void *mem);
    162168
    163169BOOL WINAPI GetOpenFileName95(FileOpenDlgInfos *fodInfos);
     
    179185
    180186    LRESULT lRes;
    181     LPCVOID dlgtemplate;
     187    LPCVOID templateDlg;
    182188    HRSRC hRes;
    183189    HANDLE hDlgTmpl = 0;
     
    185191    /* Create the dialog from a template */
    186192
    187   if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)
    188   {
    189 #ifdef __WIN32OS2__
    190     if (!(dlgtemplate = LockResource( fodInfos->ofnInfos.hInstance)))
    191 #else
    192     if (!(dlgtemplate = LockResource( MapHModuleSL(fodInfos->ofnInfos.hInstance ))))
    193 #endif
    194     {
    195         COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    196         return FALSE;
    197     }
    198   }
    199   else if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE)
    200   {
    201 #ifdef __WIN32OS2__
    202     if (!(hRes = FindResourceA(fodInfos->ofnInfos.hInstance,
    203 #else
    204     if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),
    205 #endif
    206             (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))
    207     {
    208         COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    209         return FALSE;
    210     }
    211 #ifdef __WIN32OS2__
    212     if (!(hDlgTmpl = LoadResource( fodInfos->ofnInfos.hInstance,
    213 #else
    214     if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),
    215 #endif
    216              hRes )) ||
    217         !(dlgtemplate = LockResource( hDlgTmpl )))
    218     {
    219         COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    220         return FALSE;
    221     }
    222   }
    223   else
    224   {
    225193    if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_OPENDIALOG),RT_DIALOGA)))
    226194    {
     
    229197    }
    230198    if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) ||
    231         !(dlgtemplate = LockResource( hDlgTmpl )))
     199        !(templateDlg = LockResource( hDlgTmpl )))
    232200    {
    233201        COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    234202        return FALSE;
    235203    }
    236   }
    237 
    238204    lRes = DialogBoxIndirectParamA(COMDLG32_hInstance,
    239                                   (LPDLGTEMPLATEA) dlgtemplate,
     205                                  (LPDLGTEMPLATEA) templateDlg,
    240206                                  fodInfos->ofnInfos.hwndOwner,
    241207                                  (DLGPROC) FileOpenDlgProc95,
     
    263229
    264230    LRESULT lRes;
    265     LPCVOID dlgtemplate;
     231    LPCVOID templateDlg;
    266232    HRSRC hRes;
    267233    HANDLE hDlgTmpl = 0;
     
    269235    /* Create the dialog from a template */
    270236
    271   if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)
    272   {
    273 #ifdef __WIN32OS2__
    274     if (!(dlgtemplate = LockResource( fodInfos->ofnInfos.hInstance)))
    275 #else
    276     if (!(dlgtemplate = LockResource( MapHModuleSL(fodInfos->ofnInfos.hInstance ))))
    277 #endif
    278     {
    279         COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    280         return FALSE;
    281     }
    282   }
    283   else if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE)
    284   {
    285 #ifdef __WIN32OS2__
    286     if (!(hRes = FindResourceA(fodInfos->ofnInfos.hInstance,
    287 #else
    288     if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),
    289 #endif
    290             (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))
    291     {
    292         COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    293         return FALSE;
    294     }
    295 #ifdef __WIN32OS2__
    296     if (!(hDlgTmpl = LoadResource( fodInfos->ofnInfos.hInstance,
    297 #else
    298     if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),
    299 #endif
    300              hRes )) ||
    301         !(dlgtemplate = LockResource( hDlgTmpl )))
    302     {
    303         COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    304         return FALSE;
    305     }
    306   }
    307   else
    308   {
    309237    if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_SAVEDIALOG),RT_DIALOGA)))
    310238    {
     
    313241    }
    314242    if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) ||
    315         !(dlgtemplate = LockResource( hDlgTmpl )))
     243        !(templateDlg = LockResource( hDlgTmpl )))
    316244    {
    317245        COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    318246        return FALSE;
    319247    }
    320   }
    321248    lRes = DialogBoxIndirectParamA(COMDLG32_hInstance,
    322                                   (LPDLGTEMPLATEA) dlgtemplate,
     249                                  (LPDLGTEMPLATEA) templateDlg,
    323250                                  fodInfos->ofnInfos.hwndOwner,
    324251                                  (DLGPROC) FileOpenDlgProc95,
     
    350277  memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn);
    351278  fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner;
    352 #ifdef __WIN32OS2__
    353   fodInfos->ofnInfos.hInstance = ofn->hInstance;
    354 #else
    355279  fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance);
    356 #endif
    357280  if (ofn->lpstrFilter)
    358281  {
     
    377300      s = s+strlen(s)+1;
    378301    s++;
    379     x = (LPSTR)MemAlloc(s-ofn->lpstrCustomFilter);
     302    x = MemAlloc(s-ofn->lpstrCustomFilter);
    380303    memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter);
    381304    fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)x;
     
    395318  if (ofn->lpstrInitialDir)
    396319  {
    397       fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir));
     320      fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir)+1);
    398321      strcpy((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir);
    399322  }
     
    401324  if (ofn->lpstrTitle)
    402325  {
    403       fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle));
     326      fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle)+1);
    404327      strcpy((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle);
    405328  }
     
    410333  if (ofn->lpstrDefExt)
    411334  {
    412       fodInfos->ofnInfos.lpstrDefExt = (char *)MemAlloc(strlen(ofn->lpstrDefExt));
     335      fodInfos->ofnInfos.lpstrDefExt = MemAlloc(strlen(ofn->lpstrDefExt)+1);
    413336      strcpy((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt);
    414337  }
     
    418341  if (ofn->lpTemplateName)
    419342  {
    420       /* template don't work - using normal dialog */ 
    421       /* fodInfos->ofnInfos.lpTemplateName = MemAlloc(strlen(ofn->lpTemplateName));
    422         strcpy((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);*/
    423       fodInfos->ofnInfos.Flags &= ~OFN_ENABLETEMPLATEHANDLE;
    424       fodInfos->ofnInfos.Flags &= ~OFN_ENABLETEMPLATE;
    425       FIXME("File dialog 95 template not implemented\n");
    426      
     343      fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName;
    427344  }
    428345
     
    430347  if(!ofn->lpstrInitialDir)
    431348  {
    432     fodInfos->ofnInfos.lpstrInitialDir = (char *)MemAlloc(MAX_PATH);
     349    fodInfos->ofnInfos.lpstrInitialDir = MemAlloc(MAX_PATH);
    433350    GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir);
    434351  }
    435352
     353  /* Initialise the dialog property */
     354  fodInfos->DlgInfos.dwDlgProp = 0;
     355 
    436356  switch(iDlgType)
    437357  {
     
    440360      break;
    441361  case SAVE_DIALOG :
     362      fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
    442363      ret = GetSaveFileName95(fodInfos);
    443364      break;
     
    497418  fodInfos->ofnInfos.lStructSize = sizeof(*ofn);
    498419  fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner;
    499 #ifdef __WIN32OS2__
    500   fodInfos->ofnInfos.hInstance = ofn->hInstance;
    501 #else
    502420  fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance);
    503 #endif
    504421  if (ofn->lpstrFilter)
    505422  {
     
    555472    fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle);
    556473  if (ofn->lpstrInitialDir)
    557     fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir));
     474  {
     475    fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1);
     476    lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,(LPWSTR)ofn->lpstrInitialDir);
     477  }
    558478  if (ofn->lpstrTitle)
    559     fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle));
     479  {
     480    fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)+1);
     481    lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrTitle,(LPWSTR)ofn->lpstrTitle);
     482  }
    560483  fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE;
    561484  fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset;
    562485  fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension;
    563486  if (ofn->lpstrDefExt)
    564     fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt));
     487  {
     488    fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)+1);
     489    lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrDefExt,(LPWSTR)ofn->lpstrDefExt);
     490  }
    565491  fodInfos->ofnInfos.lCustData = ofn->lCustData;
    566492  fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
    567493  if (ofn->lpTemplateName)
    568     fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName));
     494  {
     495    fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1);
     496    lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,(LPWSTR)ofn->lpTemplateName);
     497  }
     498  /* Initialise the dialog property */
     499  fodInfos->DlgInfos.dwDlgProp = 0;
     500 
    569501  switch(iDlgType)
    570502  {
     
    573505      break;
    574506  case SAVE_DIALOG :
     507      fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG;
    575508      ret = GetSaveFileName95(fodInfos);
    576509      break;
     
    579512  }
    580513     
    581 
    582514  /* Cleaning */
    583515  ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset;
     
    612544}
    613545
     546void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg)
     547{
     548
     549        HWND hwndChild,hwndStc32;
     550        RECT rectParent,rectChild,rectCtrl,rectStc32;
     551        POINT ptMoveCtl;
     552        HDWP handle;
     553        POINT ptParentClient;
     554
     555        ptMoveCtl.x = ptMoveCtl.y = 0;
     556        hwndStc32=GetDlgItem(hwndChildDlg,stc32);
     557        GetClientRect(hwndParentDlg,&rectParent);
     558        GetClientRect(hwndChildDlg,&rectChild);
     559        if(hwndStc32)
     560        {
     561                RECT rectTemp;
     562                GetWindowRect(hwndStc32,&rectStc32);
     563                MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     564                CopyRect(&rectTemp,&rectStc32);
     565
     566                SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
     567                SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
     568                if(rectStc32.right < rectTemp.right)
     569                {
     570                        ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
     571                        ptMoveCtl.x = 0;
     572                }
     573                else
     574                {
     575                        ptMoveCtl.x = (rectStc32.right - rectTemp.right);
     576                        ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
     577                }
     578                if(rectStc32.bottom < rectTemp.bottom)
     579                {
     580                        ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
     581                        ptMoveCtl.y = 0;
     582                }
     583                else
     584                {
     585                        ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
     586                        ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
     587                }
     588        }
     589        else
     590        {
     591                if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL)
     592                   return;
     593                ptParentClient.x = rectParent.right-rectParent.left;
     594                ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
     595                ptMoveCtl.y = rectParent.bottom-rectParent.top;
     596                ptMoveCtl.x=0;
     597        }
     598        SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
     599        AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
     600
     601        SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y,
     602                 SWP_NOZORDER );
     603        SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
     604                (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
     605       
     606        hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
     607        handle = BeginDeferWindowPos( 1 );
     608        if(hwndStc32)
     609        {
     610                GetWindowRect(hwndStc32,&rectStc32);
     611                MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     612        }
     613        else
     614                SetRect(&rectStc32,0,0,0,0);
     615        if (hwndChild && handle)
     616        {
     617                do
     618                {
     619                        if(hwndChild != hwndStc32)
     620                        {
     621                        if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
     622                                continue;
     623                        GetWindowRect(hwndChild,&rectCtrl);
     624                        MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
     625                        if(rectCtrl.top > rectStc32.top)
     626                        {
     627                                 
     628                                if(ptMoveCtl.x > 0)
     629                                        rectCtrl.left += ptMoveCtl.x;
     630                                rectCtrl.top  += ptMoveCtl.y;
     631                                handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top,
     632                                rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
     633                                SWP_NOSIZE | SWP_NOZORDER );
     634                                }
     635                        }
     636                }
     637                while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL && handle);
     638        }               
     639        if(handle)
     640                EndDeferWindowPos( handle );
     641        handle = BeginDeferWindowPos( 1 );
     642        hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
     643        if(hwndStc32)
     644        {
     645                GetWindowRect(hwndStc32,&rectStc32);
     646                MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     647                ptMoveCtl.x = rectStc32.left - 0;
     648                ptMoveCtl.y = rectStc32.top - 0;
     649                if (hwndChild && handle)
     650                {
     651                        do
     652                        {
     653                                if(hwndChild != hwndChildDlg)
     654                                {
     655
     656                                        if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
     657                                                continue;
     658                                        GetWindowRect(hwndChild,&rectCtrl);
     659                                        MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
     660
     661                                        rectCtrl.left += ptMoveCtl.x;
     662                                        rectCtrl.top += ptMoveCtl.y;
     663
     664                                        handle = DeferWindowPos(        handle, hwndChild, 0, rectCtrl.left, rectCtrl.top,
     665                                        rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
     666                                        SWP_NOSIZE |SWP_NOZORDER );
     667                                }
     668                        }
     669                        while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
     670                }               
     671                if(handle)
     672                EndDeferWindowPos( handle );
     673        }
     674
     675}
     676
     677
     678HRESULT WINAPI FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     679{
     680  static WNDPROC procUserHook=NULL;
     681  switch(uMsg)
     682  {
     683        case WM_INITDIALOG:
     684        {         
     685                FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *)lParam;
     686                procUserHook=NULL;
     687                lParam = (LPARAM) &fodInfos->ofnInfos;
     688                ArrangeCtrlPositions(hwnd,GetParent(hwnd));
     689                if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK)
     690                        procUserHook = (WNDPROC) fodInfos->ofnInfos.lpfnHook;
     691                if(procUserHook)
     692                         return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam);
     693                return 0;       
     694        } }
     695 if(procUserHook)
     696      return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam);
     697  return DefWindowProcA(hwnd,uMsg,wParam,lParam);
     698}
     699
     700HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos,HWND hwnd)
     701{
     702    LPCVOID templateDlg;
     703    HRSRC hRes;
     704    HANDLE hDlgTmpl = 0;
     705    HWND hChildDlg = 0;
     706   if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)
     707   {
     708        if (fodInfos->ofnInfos.Flags  & OFN_ENABLETEMPLATEHANDLE)
     709        {
     710           if( !(templateDlg = LockResource( fodInfos->ofnInfos.hInstance)))
     711                {
     712                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     713                return (HWND)NULL;
     714                }
     715               
     716        }
     717        else
     718        {
     719         if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),
     720            (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))
     721        {
     722                COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     723                 return (HWND)NULL;
     724        }
     725        if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),
     726             hRes )) ||
     727                 !(templateDlg = LockResource( hDlgTmpl )))
     728        {
     729                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     730                return (HWND)NULL;
     731        }
     732        }
     733
     734        hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,(LPCDLGTEMPLATEA)templateDlg,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     735        if(hChildDlg)
     736        {
     737                ShowWindow(hChildDlg,SW_SHOW);
     738                return hChildDlg;
     739        }
     740 }
     741 else if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook)
     742 {
     743        RECT rectHwnd;
     744        DLGTEMPLATE tmplate;
     745        GetClientRect(hwnd,&rectHwnd);
     746        tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
     747        tmplate.dwExtendedStyle = 0;
     748        tmplate.cdit = 0;
     749        tmplate.x = 0;
     750        tmplate.y = 0;
     751        tmplate.cx = rectHwnd.right-rectHwnd.left;
     752        tmplate.cy = rectHwnd.bottom-rectHwnd.top;
     753       
     754        return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     755 }
     756return (HWND)NULL;
     757}
    614758
    615759/***********************************************************************
     
    624768  {
    625769    case WM_INITDIALOG :
     770        CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
    626771      return FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
    627772    case WM_COMMAND:
     
    637782      }
    638783      return FALSE;
    639 #ifndef __WIN32OS2__         
     784         
    640785    case WM_GETISHELLBROWSER:
    641786      return FILEDLG95_OnWMGetIShellBrowser(hwnd);
    642 #endif
    643787
    644788  case WM_DESTROY:
    645789      RemovePropA(hwnd, FileOpenDlgInfosStr);
     790
    646791    default :
    647792      return FALSE;
     
    698843
    699844  /* Free pidlItem memory */
    700   SHFree(pidlItemId);
     845  COMDLG32_SHFree(pidlItemId);
    701846
    702847  return TRUE;
     
    722867  WORD wNotifyCode = HIWORD(wParam); /* notification code */
    723868  WORD wID = LOWORD(wParam);         /* item, control, or accelerator identifier */
     869  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    724870
    725871  switch(wID)
     
    763909
    764910  }
    765 
     911  /* Do not use the listview selection anymore */
     912  fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
    766913  return 0;
    767914}
     
    851998  }
    852999
     1000  /* List View is selected by default */
     1001  SendDlgItemMessageA(hwnd, IDC_LIST, BM_SETCHECK,(WPARAM) BST_CHECKED,0);
     1002
    8531003  return 0;
    8541004}
     
    8631013BOOL FILEDLG95_OnOpen(HWND hwnd)
    8641014{
    865   char lpstrFileName[MAX_PATH];
     1015  char lpstrSpecifiedByUser[MAX_PATH] = "";
    8661016  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     1017  LPITEMIDLIST pidlSelection;
    8671018
    8681019  TRACE("\n");
    8691020
    870   if(GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileName,MAX_PATH))
    871   {
    872     char *tmp;
    873     char lpstrFile[MAX_PATH];
    874 
    875     /* Get the selected file name and path */
    876     SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
    877                          lpstrFile);
    878     if(strcmp(&lpstrFile[strlen(lpstrFile)-1],"\\"))
    879         strcat(lpstrFile,"\\");
    880     strcat(lpstrFile,lpstrFileName);
     1021  /* Check if there is a selected item in the listview */
     1022  if(fodInfos->DlgInfos.dwDlgProp & FODPROP_USEVIEW)
     1023  {
     1024      pidlSelection = GetSelectedPidl(fodInfos->Shell.FOIShellView);
     1025      GetName(fodInfos->Shell.FOIShellFolder,pidlSelection,SHGDN_NORMAL,lpstrSpecifiedByUser);
     1026      COMDLG32_SHFree((LPVOID)pidlSelection);
     1027  }
     1028  else
     1029      /* Get the text from the filename edit */
     1030      GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH);
     1031
     1032  if(strlen(lpstrSpecifiedByUser))
     1033  {
     1034      LPSHELLFOLDER psfDesktop;
     1035      LPITEMIDLIST browsePidl;
     1036      LPSTR lpstrFileSpec;
     1037      LPSTR lpstrTemp;
     1038      char lpstrPathSpec[MAX_PATH] = "";
     1039      char lpstrCurrentDir[MAX_PATH] = "";
     1040      char lpstrPathAndFile[MAX_PATH] = "";
     1041
     1042      /* Separate the file spec from the path spec
     1043         e.g.:
     1044              lpstrSpecifiedByUser  lpstrPathSpec  lpstrFileSpec
     1045              C:\TEXT1\TEXT2        C:\TEXT1          TEXT2
     1046      */     
     1047      lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser);
     1048      strcpy(lpstrPathSpec,lpstrSpecifiedByUser);
     1049      COMDLG32_PathRemoveFileSpecA(lpstrPathSpec);
     1050     
     1051      /* Get the current directory name */
     1052      COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
     1053                                    lpstrCurrentDir);
     1054
     1055      /* Create an absolute path name */
     1056      if(lpstrSpecifiedByUser[1] != ':')
     1057      {
     1058          switch(lpstrSpecifiedByUser[0])
     1059          {
     1060          /* Add drive spec  \TEXT => C:\TEXT */
     1061          case '\\':
     1062              {
     1063                  INT iCopy = 2;
     1064                  char lpstrTmp[MAX_PATH] = "";
     1065                  if(!strlen(lpstrPathSpec))
     1066                      iCopy = 3;
     1067                  strncpy(lpstrTmp,lpstrCurrentDir,iCopy);
     1068                  strcat(lpstrTmp,lpstrPathSpec);
     1069                  strcpy(lpstrPathSpec,lpstrTmp);
     1070              }
     1071              break;           
     1072          /* Go to parent ..\TEXT */
     1073          case '.':
     1074              {
     1075                  INT iSize;
     1076                  char lpstrTmp2[MAX_PATH] = "";
     1077                  LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\');
     1078                  iSize = lpstrTmp - lpstrCurrentDir;
     1079                  strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1);
     1080                  if(strlen(lpstrSpecifiedByUser) <= 3)
     1081                      strcpy(lpstrFileSpec,"");
     1082                  if(strcmp(lpstrPathSpec,".."))
     1083                      strcat(lpstrTmp2,&lpstrPathSpec[3]);
     1084                  strcpy(lpstrPathSpec,lpstrTmp2);
     1085              }
     1086              break;
     1087          default:
     1088  {
     1089                  char lpstrTmp[MAX_PATH] = "";
     1090                  if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\"))
     1091                      strcat(lpstrCurrentDir,"\\");
     1092                  strcpy(lpstrTmp,lpstrCurrentDir);
     1093                  strcat(lpstrTmp,lpstrPathSpec);
     1094                  strcpy(lpstrPathSpec,lpstrTmp);
     1095              }
     1096                 
     1097          } /* end switch */
     1098      }
     1099
     1100      if(strlen(lpstrPathSpec))
     1101      {
     1102          /* Browse to the right directory */
     1103          COMDLG32_SHGetDesktopFolder(&psfDesktop);
     1104          if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec)))
     1105          {
     1106              /* Browse to directory */
     1107              IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
     1108                                         browsePidl,
     1109                                         SBSP_ABSOLUTE);
     1110              COMDLG32_SHFree(browsePidl);
     1111          }
     1112          else
     1113          {
     1114              /* Path does not exist */
     1115              if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
     1116              {
     1117                  MessageBoxA(hwnd,
     1118                              "Path does not exist",
     1119                              fodInfos->ofnInfos.lpstrTitle,
     1120                              MB_OK | MB_ICONEXCLAMATION);
     1121                  return FALSE;
     1122              }
     1123          }
     1124         
     1125          strcat(lpstrPathAndFile,lpstrPathSpec);
     1126          IShellFolder_Release(psfDesktop);
     1127      }
     1128      else
     1129      {
     1130          strcat(lpstrPathAndFile,lpstrCurrentDir);
     1131      }
     1132
     1133      /* Create the path and file string */
     1134      COMDLG32_PathAddBackslashA(lpstrPathAndFile);
     1135      strcat(lpstrPathAndFile,lpstrFileSpec);
     1136     
     1137      /* Update the edit field */
     1138      SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec);
     1139      SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1);
     1140     
     1141      /* Don't go further if we dont have a file spec */
     1142      if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec))
     1143          return FALSE;
     1144
     1145      /* Time to check lpstrFileSpec         */
     1146      /* search => contains * or ?           */
     1147      /* browse => contains a directory name */
     1148      /* file   => contains a file name      */
    8811149
    8821150    /* Check if this is a search */
    883     if(strchr(lpstrFileName,'*') || strchr(lpstrFileName,'?'))
     1151      if(strchr(lpstrFileSpec,'*') || strchr(lpstrFileSpec,'?'))
    8841152    {
    8851153      int iPos;
     
    8891157         MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
    8901158
    891       fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileName)+1)*2);
    892       lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,(LPSTR)strlwr((LPSTR)lpstrFileName));
    893 
     1159          fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileSpec)+1)*2);
     1160          lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,
     1161                      (LPSTR)strlwr((LPSTR)lpstrFileSpec));
    8941162     
    8951163      IShellView_Refresh(fodInfos->Shell.FOIShellView);
    8961164
    897       if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,lpstrFileName)))
     1165          if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,
     1166                                                       lpstrFileSpec)))
    8981167        CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,iPos);
    8991168
     
    9011170    }
    9021171
    903     /* Check file extension */
    904 
    905     if(!strrchr(lpstrFile,'.'))
     1172      /* browse if the user specified a directory */
     1173      if((browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
     1174                                       lpstrFileSpec)))
    9061175    {
    907         /* if the file has no extension, append the selected
    908            extension of the filetype combo box */
    909         int iExt;
    910         LPSTR lpstrExt;
    911         LPSTR lpstrTmp;
    912         iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    913         lpstrTmp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt);
    914 
    915         if((lpstrExt = strchr(lpstrTmp,';')))
     1176          ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
     1177          IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder,
     1178                                       1,
     1179                                       &browsePidl,
     1180                                       &ulAttr);
     1181
     1182          /* Browse to directory */
     1183          if(ulAttr)
    9161184        {
    917             int i = lpstrExt - lpstrTmp;
    918             lpstrExt = MemAlloc(i);
    919             strncpy(lpstrExt,&lpstrTmp[1],i-1);
     1185              if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,
     1186                                                   browsePidl,
     1187                                                   SBSP_RELATIVE)))
     1188        {
     1189                  if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
     1190        {
     1191                      MessageBoxA(hwnd,
     1192                                  "Path does not exist",
     1193                                  fodInfos->ofnInfos.lpstrTitle,
     1194                                  MB_OK | MB_ICONEXCLAMATION);
     1195                      COMDLG32_SHFree(browsePidl);
     1196                      return FALSE;
    9201197        }
    921         else
    922         {
    923             lpstrExt = MemAlloc(strlen(lpstrTmp)-1);
    924             strcpy(lpstrExt,&lpstrTmp[1]);
    925         }
    926 
    927         if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)
    928         {
    929             lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+1);
    930             strcat(lpstrExt,".");
    931             strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);
    932         }
    933 
    934         strcat(lpstrFile,lpstrExt);
    9351198    }
    936     /* Check if the selected file exist */
    937 
    938     if(strlen(lpstrFile) > fodInfos->ofnInfos.nMaxFile)
     1199              COMDLG32_SHFree(browsePidl);
     1200              return FALSE;
     1201    }
     1202          COMDLG32_SHFree(browsePidl);
     1203      }
     1204      else
    9391205    {
    940         /* set error FNERR_BUFFERTOSMALL */
    941         FILEDLG95_Clean(hwnd);
    942         return EndDialog(hwnd,FALSE);
    943     }
    944     strcpy(fodInfos->ofnInfos.lpstrFile,lpstrFile);
    945 
    946     /* Set the lpstrFileTitle of the OPENFILENAME structure */
    947     if(fodInfos->ofnInfos.lpstrFileTitle)
    948       strncpy(fodInfos->ofnInfos.lpstrFileTitle,
    949               lpstrFileName,
    950               fodInfos->ofnInfos.nMaxFileTitle);
    951 
    952     /* Check if the file is to be opened as read only */
    953     if(BST_CHECKED == SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_GETSTATE,0,0))
    954       SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,FILE_ATTRIBUTE_READONLY);
    955 
    956     /*  nFileExtension and nFileOffset of OPENFILENAME structure */
    957     tmp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\');
    958     fodInfos->ofnInfos.nFileOffset = tmp - fodInfos->ofnInfos.lpstrFile + 1;
    959     tmp = strrchr(fodInfos->ofnInfos.lpstrFile,'.');
    960     fodInfos->ofnInfos.nFileExtension = tmp - fodInfos->ofnInfos.lpstrFile + 1;
    961 
    962     /* Check if selected file exists */
    963     if(!GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrFileName))
    964     {
     1206          /* File does not exist in current directory */
     1207
     1208          /* The selected file does not exist */
    9651209      /* Tell the user the selected does not exist */
    9661210      if(fodInfos->ofnInfos.Flags & OFN_FILEMUSTEXIST)
     
    9701214        char tmp[400];
    9711215
    972         LoadStringA(COMDLG32_hInstance,IDS_FILENOTFOUND,lpstrNotFound,100);
    973         LoadStringA(COMDLG32_hInstance,IDS_VERIFYFILE,lpstrMsg,100);
     1216              LoadStringA(COMDLG32_hInstance,
     1217                          IDS_FILENOTFOUND,
     1218                          lpstrNotFound,
     1219                          100);
     1220              LoadStringA(COMDLG32_hInstance,
     1221                          IDS_VERIFYFILE,
     1222                          lpstrMsg,
     1223                          100);
    9741224
    9751225        strcpy(tmp,fodInfos->ofnInfos.lpstrFile);
     
    9791229        strcat(tmp,lpstrMsg);
    9801230
    981         MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,MB_OK | MB_ICONEXCLAMATION);
     1231              MessageBoxA(hwnd,
     1232                          tmp,
     1233                          fodInfos->ofnInfos.lpstrTitle,
     1234                          MB_OK | MB_ICONEXCLAMATION);
    9821235        return FALSE;
    9831236      }
     
    9891242        LoadStringA(COMDLG32_hInstance,IDS_CREATEFILE,tmp,100);
    9901243
    991         if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,MB_YESNO | MB_ICONQUESTION))
     1244              if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,
     1245                                      MB_YESNO | MB_ICONQUESTION))
    9921246        {
    9931247            /* Create the file, clean and exit */
     
    9981252      }
    9991253    }
     1254
     1255      /* Open the selected file */
     1256
     1257      /* Check file extension */
     1258      if(!strrchr(lpstrPathAndFile,'.'))
     1259      {
     1260          /* if the file has no extension, append the selected
     1261             extension of the filetype combo box */
     1262          int iExt;
     1263          LPSTR lpstrExt;
     1264          iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
     1265          lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt);
     1266
     1267          if((lpstrExt = strchr(lpstrTemp,';')))
     1268          {
     1269              int i = lpstrExt - lpstrTemp;
     1270              lpstrExt = MemAlloc(i);
     1271              strncpy(lpstrExt,&lpstrTemp[1],i-1);
     1272          }
     1273          else
     1274          {
     1275              lpstrExt = MemAlloc(strlen(lpstrTemp));
     1276              strcpy(lpstrExt,&lpstrTemp[1]);
     1277          }
     1278                 
     1279          if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)
     1280          {
     1281              lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2);
     1282              strcat(lpstrExt,".");
     1283              strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);
     1284          }
     1285          strcat(lpstrPathAndFile,lpstrExt);
     1286      }
     1287      /* Check that size size of the file does not exceed buffer size */
     1288      if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos.nMaxFile)
     1289      {
     1290          /* set error FNERR_BUFFERTOSMALL */
     1291          FILEDLG95_Clean(hwnd);
     1292          return EndDialog(hwnd,FALSE);
     1293      }
     1294      strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile);
     1295
     1296      /* Set the lpstrFileTitle of the OPENFILENAME structure */
     1297      if(fodInfos->ofnInfos.lpstrFileTitle)
     1298          strncpy(fodInfos->ofnInfos.lpstrFileTitle,
     1299                  lpstrFileSpec,
     1300                  fodInfos->ofnInfos.nMaxFileTitle);
     1301
     1302      /* Check if the file is to be opened as read only */           
     1303      if(BST_CHECKED == SendDlgItemMessageA(hwnd,
     1304                                            IDC_OPENREADONLY,
     1305                                            BM_GETSTATE,0,0))
     1306          SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,
     1307                             FILE_ATTRIBUTE_READONLY);
     1308
     1309      /*  nFileExtension and nFileOffset of OPENFILENAME structure */
     1310      lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\');
     1311      fodInfos->ofnInfos.nFileOffset = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;
     1312      lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'.');
     1313      fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;
     1314
     1315   
    10001316    /* clean and exit */
    10011317    FILEDLG95_Clean(hwnd);
     
    10241340
    10251341  fodInfos->Shell.FOIShellView = NULL;
    1026   if(FAILED(SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder)))
     1342  if(FAILED(COMDLG32_SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder)))
    10271343    return E_FAIL;
    10281344
     
    11771493          break;
    11781494
    1179       lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp));
     1495      lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp)+1);
    11801496      if(!lpstrExt)
    11811497          break;
     
    12301546      lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
    12311547                                             iItem);
    1232       if(lpstrFilter)
     1548      if((INT)lpstrFilter != CB_ERR)
    12331549      {
    12341550        fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFilter)+1)*2);
     
    13111627
    13121628  SetPropA(hwndCombo, LookInInfosStr, (HANDLE) liInfos);
     1629  CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON));
    13131630
    13141631  /* Initialise data of Desktop folder */
    1315   SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp);
     1632  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp);
    13161633  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
    1317   SHFree(pidlTmp);
    1318 
    1319   SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives);
    1320 
    1321   SHGetDesktopFolder(&psfRoot);
     1634  COMDLG32_SHFree(pidlTmp);
     1635
     1636  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives);
     1637
     1638  COMDLG32_SHGetDesktopFolder(&psfRoot);
    13221639
    13231640  if (psfRoot)
     
    13311648
    13321649        /* special handling for CSIDL_DRIVES */
    1333         if (ILIsEqual(pidlTmp, pidlDrives))
     1650        if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives))
    13341651        {
    13351652          if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives)))
     
    13401657              while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL))
    13411658              {
    1342                 pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);
     1659                pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1);
    13431660                FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND);
    1344                 SHFree(pidlAbsTmp);
    1345                 SHFree(pidlTmp1);
     1661                COMDLG32_SHFree(pidlAbsTmp);
     1662                COMDLG32_SHFree(pidlTmp1);
    13461663              }
    13471664              IEnumIDList_Release(lpeDrives);
     
    13501667          }
    13511668        }
    1352         SHFree(pidlTmp);
     1669        COMDLG32_SHFree(pidlTmp);
    13531670      }
    13541671      IEnumIDList_Release(lpeRoot);
     
    13571674
    13581675  IShellFolder_Release(psfRoot);
    1359   SHFree(pidlDrives);
     1676  COMDLG32_SHFree(pidlDrives);
    13601677
    13611678  return NOERROR;
     
    13941711  if(pDIStruct->itemID == liInfos->uSelectedItem)
    13951712  {
    1396     ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
     1713    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
    13971714                                               0,   
    13981715                                               &sfi,   
     
    14041721  else
    14051722  {
    1406     ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
     1723    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
    14071724                                                  0,
    14081725                                                  &sfi,
     
    14311748  {
    14321749    iIndentation = 0;
    1433     ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
     1750    ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
    14341751                                                0,
    14351752                                                &sfi,
     
    14951812      iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB);
    14961813
    1497       tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
    1498                                                iItem);
     1814      if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB,
     1815                                               iItem)))
     1816        return FALSE;
    14991817
    15001818
     
    15371855  /* Calculate the indentation of the item in the lookin*/
    15381856  pidlNext = pidl;
    1539   while( (pidlNext=ILGetNext(pidlNext)) )
     1857  while( (pidlNext=COMDLG32_PIDL_ILGetNext(pidlNext)) )
    15401858  {
    15411859    tmpFolder->m_iIndent++;
    15421860  }
    15431861
    1544   tmpFolder->pidlItem = ILClone(pidl);
     1862  tmpFolder->pidlItem = COMDLG32_PIDL_ILClone(pidl);
    15451863
    15461864  if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
    15471865    liInfos->iMaxIndentation = tmpFolder->m_iIndent;
    15481866 
    1549   SHGetFileInfoA((LPSTR)pidl,
     1867  COMDLG32_SHGetFileInfoA((LPSTR)pidl,
    15501868                  0,
    15511869                  &sfi,
     
    15981916
    15991917  /* Free pidlParent memory */
    1600   SHFree((LPVOID)pidlParent);
     1918  COMDLG32_SHFree((LPVOID)pidlParent);
    16011919
    16021920  return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1);
     
    16932011    LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i);
    16942012
    1695     if(iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem))
     2013    if(iSearchMethod == SEARCH_PIDL && COMDLG32_PIDL_ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem))
    16962014      return i;
    16972015    if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg)
     
    17502068  {
    17512069    HRESULT hRes;
    1752     SHGetDesktopFolder(&lpsf);
     2070    COMDLG32_SHGetDesktopFolder(&lpsf);
    17532071    hRes = GetName(lpsf,pidl,dwFlags,lpstrFileName);
    17542072    IShellFolder_Release(lpsf);
     
    17622080                                                     &str)))
    17632081  {
    1764     return StrRetToStrNA(lpstrFileName, MAX_PATH, &str, pidl);
     2082      return StrRetToBufA(&str, pidl,lpstrFileName, MAX_PATH);
    17652083  }
    17662084  return E_FAIL;
     
    17792097  TRACE("%p\n", pidlAbs);
    17802098
    1781   if(SUCCEEDED(SHGetDesktopFolder(&psfParent)))
     2099  if(SUCCEEDED(COMDLG32_SHGetDesktopFolder(&psfParent)))
    17822100  {
    17832101    psf = psfParent;
    17842102    if(pidlAbs && pidlAbs->mkid.cb)
    17852103    {
    1786       if(FAILED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
     2104      if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
    17872105      {
    1788         psf = NULL;
     2106        IShellFolder_Release(psfParent);
     2107        return psf;
    17892108      }
    17902109    }
    1791     IShellFolder_Release(psfParent);
    1792   }
    1793 
    1794   return psf;
    1795 
     2110    /* return the desktop */
     2111    return psfParent;
     2112  }
     2113  return NULL;
    17962114}
    17972115
     
    18072125  TRACE("%p\n", pidl);
    18082126
    1809   pidlParent = ILClone(pidl);
    1810   ILRemoveLastID(pidlParent);
    1811 
     2127  pidlParent = COMDLG32_PIDL_ILClone(pidl);
     2128  COMDLG32_PIDL_ILRemoveLastID(pidlParent);
     2129     
    18122130  return pidlParent;
    1813 
    18142131}
    18152132
     
    18252142  ULONG ulEaten;
    18262143  wchar_t lpwstrDirName[MAX_PATH];
     2144
    18272145
    18282146  TRACE("sf=%p file=%s\n", psf, lpcstrFileName);
     
    18382156                      MAX_PATH); 
    18392157
    1840    
    1841 
    1842   if(SUCCEEDED(IShellFolder_ParseDisplayName(psf,
    1843                                              0,
     2158  IShellFolder_ParseDisplayName(psf,                                0,
    18442159                                             NULL,
    18452160                                             (LPWSTR)lpwstrDirName,
    18462161                                             &ulEaten,
    18472162                                             &pidl,
    1848                                              NULL)))
    1849   {
     2163                                NULL);   
     2164
    18502165    return pidl;
    1851   }
    1852   return NULL;
    18532166}
    18542167
  • trunk/src/comdlg32/filedlgbrowser.cpp

    r1548 r1556  
    1 /* $Id: filedlgbrowser.cpp,v 1.1 1999-11-02 19:09:42 sandervl Exp $ */
    21/*
    3  *  Implementation of IShellBrowser for the File Open common dialog (990815)
     2 *  Implementation of IShellBrowser for the File Open common dialog
    43 *
    54 *
    65 */
     6
     7#include <stdio.h>
     8#ifdef __WIN32OS2__
    79// ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error
    810#define CINTERFACE 1
    9 
    10 #include <stdio.h>
     11#include <os2win.h>
    1112#include "unknwn.h"
    12 #include <os2win.h>
    1313#include "filedlgbrowser.h"
     14#else
     15#include "unknwn.h"
     16#include "filedlgbrowser.h"
     17#include "winuser.h"
     18#endif
    1419#include "heap.h"
    15 #include "commctrl.h"
    1620#include "wine/obj_dataobject.h"
    1721#include "debugtools.h"
     
    7781
    7882HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
     83#if 0
    7984LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
     85#endif
    8086
    8187/**************************************************************************
     
    116122    sb->lpVtbl2 = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
    117123
    118     SHGetSpecialFolderLocation(hwndOwner,
     124    COMDLG32_SHGetSpecialFolderLocation(hwndOwner,
    119125                               CSIDL_DESKTOP,
    120126                               &fodInfos->ShellInfos.pidlAbsCurrent);
     
    194200    if (!--(This->ref))
    195201    {
    196       SHFree(This);
     202      COMDLG32_SHFree(This);
    197203      return 0;
    198204    }
     
    287293        }
    288294        /* create an absolute pidl */
    289         pidlTmp = ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
     295        pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
    290296                                                        (LPITEMIDLIST)pidl);
    291297       
     
    302308    {
    303309        /* An absolute pidl (relative from the desktop) */
    304         pidlTmp = ILClone((LPITEMIDLIST)pidl);
     310        pidlTmp =  COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
    305311        psfTmp = GetShellFolderFromPidl(pidlTmp);
    306312    }
    307313
     314   
    308315    /* Retrieve the IShellFolder interface of the pidl specified folder */
    309316    if(!psfTmp)
    310317        return E_FAIL;
     318
     319    /* If the pidl to browse to is equal to the actual pidl ...
     320       do nothing and pretend you did it*/
     321    if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
     322    {
     323        IShellFolder_Release(psfTmp);
     324        COMDLG32_SHFree(pidlTmp);
     325        return NOERROR;
     326    }
    311327
    312328    /* Release the current fodInfos->Shell.FOIShellFolder and update its value */
     
    349365
    350366            /* Release old pidlAbsCurrent memory and update its value */
    351             SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
     367            COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
    352368            fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
    353369
     
    626642        HRESULT hRes;
    627643
    628         /* Selected item is a directory so browse to it */
    629 
    630644        ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    631645        IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
     
    634648        /* Tell the dialog that the user selected a file */
    635649        else
     650        {
    636651            hRes = FILEDLG95_OnOpen(This->hwndOwner);
     652        }
    637653
    638654        /* Free memory used by pidl */
    639         SHFree((LPVOID)pidl);
     655        COMDLG32_SHFree((LPVOID)pidl);
    640656
    641657        return hRes;
     
    662678            break;
    663679        case CDBOSC_KILLFOCUS:
     680            {
     681                FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     682                if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     683                    SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     684            }
    664685            break;
    665686        case CDBOSC_SELCHANGE:
     
    705726
    706727    if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_FORPARSING, &str)))
    707     { if (SUCCEEDED(StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
     728    { if (SUCCEEDED(StrRetToBufW(&str, pidl,szPathW, MAX_PATH)))
    708729      {
    709         if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
     730          if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
    710731          return S_OK;
    711732      }
     
    721742{
    722743    LPITEMIDLIST pidl;
    723 
     744    FileOpenDlgInfos *fodInfos;
    724745    _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
    725746
     747    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    726748    TRACE("(%p)\n", This);
    727749
     
    731753        char lpstrFileName[MAX_PATH];
    732754   
    733         FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    734 
    735755        ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    736756        IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
     
    739759            if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName)))
    740760                SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName);
     761            if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     762                    SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
    741763        }
    742 
    743         SHFree((LPVOID)pidl);
     764        else
     765            SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
     766
     767        fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
     768
     769        COMDLG32_SHFree((LPVOID)pidl);
    744770        return hRes;
    745771    }
    746 
     772    if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     773        SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     774
     775    fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
    747776    return E_FAIL;
    748777}
     
    780809            LPIDA cida = (LPIDA)GlobalLock(medium.u.hGlobal);
    781810            TRACE("cida=%p\n", cida);
    782             pidlSelected = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));
     811            pidlSelected =  COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));
    783812
    784813            if(medium.pUnkForRelease)
Note: See TracChangeset for help on using the changeset viewer.