user32: Implement IDI_SHIELD.
[wine.git] / dlls / commdlg.dll16 / filedlg.c
blob7e2fda739fabdda552765bdc4ce0016c9ddb61df
1 /*
2 * COMMDLG - File Dialogs
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "wine/winbase16.h"
25 #include "wingdi.h"
26 #include "winuser.h"
27 #include "commdlg.h"
28 #include "cdlg16.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
33 static UINT_PTR CALLBACK dummy_hook( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
35 return FALSE;
38 /***********************************************************************
39 * FileOpenDlgProc (COMMDLG.6)
41 BOOL16 CALLBACK FileOpenDlgProc16(HWND16 hWnd16, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam)
43 FIXME( "%04x %04x %04x %08lx: stub\n", hWnd16, wMsg, wParam, lParam );
44 return FALSE;
47 /***********************************************************************
48 * FileSaveDlgProc (COMMDLG.7)
50 BOOL16 CALLBACK FileSaveDlgProc16(HWND16 hWnd16, UINT16 wMsg, WPARAM16 wParam, LPARAM lParam)
52 FIXME( "%04x %04x %04x %08lx: stub\n", hWnd16, wMsg, wParam, lParam );
53 return FALSE;
56 /***********************************************************************
57 * GetOpenFileName (COMMDLG.1)
59 * Creates a dialog box for the user to select a file to open.
61 * RETURNS
62 * TRUE on success: user selected a valid file
63 * FALSE on cancel, error, close or filename-does-not-fit-in-buffer.
65 * BUGS
66 * unknown, there are some FIXMEs left.
68 BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn ) /* [in/out] address of structure with data*/
70 LPOPENFILENAME16 lpofn = MapSL(ofn);
71 OPENFILENAMEA ofn32;
72 BOOL ret;
74 if (!lpofn) return FALSE;
76 ofn32.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
77 ofn32.hwndOwner = HWND_32( lpofn->hwndOwner );
78 ofn32.lpstrFilter = MapSL( lpofn->lpstrFilter );
79 ofn32.lpstrCustomFilter = MapSL( lpofn->lpstrCustomFilter );
80 ofn32.nMaxCustFilter = lpofn->nMaxCustFilter;
81 ofn32.nFilterIndex = lpofn->nFilterIndex;
82 ofn32.lpstrFile = MapSL( lpofn->lpstrFile );
83 ofn32.nMaxFile = lpofn->nMaxFile;
84 ofn32.lpstrFileTitle = MapSL( lpofn->lpstrFileTitle );
85 ofn32.nMaxFileTitle = lpofn->nMaxFileTitle;
86 ofn32.lpstrInitialDir = MapSL( lpofn->lpstrInitialDir );
87 ofn32.lpstrTitle = MapSL( lpofn->lpstrTitle );
88 ofn32.Flags = (lpofn->Flags & ~OFN_ENABLETEMPLATE) | OFN_ENABLEHOOK;
89 ofn32.nFileOffset = lpofn->nFileOffset;
90 ofn32.nFileExtension = lpofn->nFileExtension;
91 ofn32.lpstrDefExt = MapSL( lpofn->lpstrDefExt );
92 ofn32.lCustData = lpofn->lCustData;
93 ofn32.lpfnHook = dummy_hook; /* this is to force old 3.1 dialog style */
95 if (lpofn->Flags & OFN_ENABLETEMPLATE)
96 FIXME( "custom templates no longer supported, using default\n" );
97 if (lpofn->Flags & OFN_ENABLEHOOK)
98 FIXME( "custom hook %p no longer supported\n", lpofn->lpfnHook );
100 if ((ret = GetOpenFileNameA( &ofn32 )))
102 lpofn->nFilterIndex = ofn32.nFilterIndex;
103 lpofn->nFileOffset = ofn32.nFileOffset;
104 lpofn->nFileExtension = ofn32.nFileExtension;
106 return ret;
109 /***********************************************************************
110 * GetSaveFileName (COMMDLG.2)
112 * Creates a dialog box for the user to select a file to save.
114 * RETURNS
115 * TRUE on success: user enters a valid file
116 * FALSE on cancel, error, close or filename-does-not-fit-in-buffer.
118 * BUGS
119 * unknown. There are some FIXMEs left.
121 BOOL16 WINAPI GetSaveFileName16( SEGPTR ofn ) /* [in/out] address of structure with data*/
123 LPOPENFILENAME16 lpofn = MapSL(ofn);
124 OPENFILENAMEA ofn32;
125 BOOL ret;
127 if (!lpofn) return FALSE;
129 ofn32.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
130 ofn32.hwndOwner = HWND_32( lpofn->hwndOwner );
131 ofn32.lpstrFilter = MapSL( lpofn->lpstrFilter );
132 ofn32.lpstrCustomFilter = MapSL( lpofn->lpstrCustomFilter );
133 ofn32.nMaxCustFilter = lpofn->nMaxCustFilter;
134 ofn32.nFilterIndex = lpofn->nFilterIndex;
135 ofn32.lpstrFile = MapSL( lpofn->lpstrFile );
136 ofn32.nMaxFile = lpofn->nMaxFile;
137 ofn32.lpstrFileTitle = MapSL( lpofn->lpstrFileTitle );
138 ofn32.nMaxFileTitle = lpofn->nMaxFileTitle;
139 ofn32.lpstrInitialDir = MapSL( lpofn->lpstrInitialDir );
140 ofn32.lpstrTitle = MapSL( lpofn->lpstrTitle );
141 ofn32.Flags = (lpofn->Flags & ~OFN_ENABLETEMPLATE) | OFN_ENABLEHOOK;
142 ofn32.nFileOffset = lpofn->nFileOffset;
143 ofn32.nFileExtension = lpofn->nFileExtension;
144 ofn32.lpstrDefExt = MapSL( lpofn->lpstrDefExt );
145 ofn32.lCustData = lpofn->lCustData;
146 ofn32.lpfnHook = dummy_hook; /* this is to force old 3.1 dialog style */
148 if (lpofn->Flags & OFN_ENABLETEMPLATE)
149 FIXME( "custom templates no longer supported, using default\n" );
150 if (lpofn->Flags & OFN_ENABLEHOOK)
151 FIXME( "custom hook %p no longer supported\n", lpofn->lpfnHook );
153 if ((ret = GetSaveFileNameA( &ofn32 )))
155 lpofn->nFilterIndex = ofn32.nFilterIndex;
156 lpofn->nFileOffset = ofn32.nFileOffset;
157 lpofn->nFileExtension = ofn32.nFileExtension;
159 return ret;
163 /***********************************************************************
164 * GetFileTitle (COMMDLG.27)
166 short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf)
168 return GetFileTitleA(lpFile, lpTitle, cbBuf);