msvcrt: Fixed fgetwc behavior on multibyte characters and Unicode files.
[wine] / include / commdlg.h
1 /*
2  * COMMDLG - Common Wine Dialog ... :-)
3  *
4  * Copyright (C) the Wine project
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_COMMDLG_H
22 #define __WINE_COMMDLG_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <prsht.h>
29 #ifndef _WIN64
30 #include <pshpack1.h>
31 #endif
32
33 #ifndef SNDMSG
34 #ifdef __cplusplus
35 #define SNDMSG ::SendMessage
36 #else   /* __cplusplus */
37 #define SNDMSG SendMessage
38 #endif  /* __cplusplus */
39 #endif  /* SNDMSG */
40
41 #define OFN_READONLY                 0x00000001
42 #define OFN_OVERWRITEPROMPT          0x00000002
43 #define OFN_HIDEREADONLY             0x00000004
44 #define OFN_NOCHANGEDIR              0x00000008
45 #define OFN_SHOWHELP                 0x00000010
46 #define OFN_ENABLEHOOK               0x00000020
47 #define OFN_ENABLETEMPLATE           0x00000040
48 #define OFN_ENABLETEMPLATEHANDLE     0x00000080
49 #define OFN_NOVALIDATE               0x00000100
50 #define OFN_ALLOWMULTISELECT         0x00000200
51 #define OFN_EXTENSIONDIFFERENT       0x00000400
52 #define OFN_PATHMUSTEXIST            0x00000800
53 #define OFN_FILEMUSTEXIST            0x00001000
54 #define OFN_CREATEPROMPT             0x00002000
55 #define OFN_SHAREAWARE               0x00004000
56 #define OFN_NOREADONLYRETURN         0x00008000
57 #define OFN_NOTESTFILECREATE         0x00010000
58 #define OFN_NONETWORKBUTTON          0x00020000
59 #define OFN_NOLONGNAMES              0x00040000
60 #define OFN_EXPLORER                 0x00080000
61 #define OFN_NODEREFERENCELINKS       0x00100000
62 #define OFN_LONGNAMES                0x00200000
63 #define OFN_ENABLEINCLUDENOTIFY      0x00400000
64 #define OFN_ENABLESIZING             0x00800000
65 #define OFN_DONTADDTORECENT          0x02000000
66 #define OFN_FORCESHOWHIDDEN          0x10000000
67
68 #define OFN_SHAREFALLTHROUGH     2
69 #define OFN_SHARENOWARN          1
70 #define OFN_SHAREWARN            0
71
72 #define SAVE_DIALOG  1
73 #define OPEN_DIALOG  2
74
75 typedef UINT_PTR (CALLBACK *LPOFNHOOKPROC)(HWND,UINT,WPARAM,LPARAM);
76
77 typedef struct tagOFNA {
78         DWORD           lStructSize;
79         HWND            hwndOwner;
80         HINSTANCE       hInstance;
81         LPCSTR          lpstrFilter;
82         LPSTR           lpstrCustomFilter;
83         DWORD           nMaxCustFilter;
84         DWORD           nFilterIndex;
85         LPSTR           lpstrFile;
86         DWORD           nMaxFile;
87         LPSTR           lpstrFileTitle;
88         DWORD           nMaxFileTitle;
89         LPCSTR          lpstrInitialDir;
90         LPCSTR          lpstrTitle;
91         DWORD           Flags;
92         WORD            nFileOffset;
93         WORD            nFileExtension;
94         LPCSTR          lpstrDefExt;
95         LPARAM          lCustData;
96         LPOFNHOOKPROC   lpfnHook;
97         LPCSTR          lpTemplateName;
98         void           *pvReserved;
99         DWORD           dwReserved;
100         DWORD           FlagsEx;
101 } OPENFILENAMEA,*LPOPENFILENAMEA;
102
103 typedef struct tagOFNW {
104         DWORD           lStructSize;
105         HWND            hwndOwner;
106         HINSTANCE       hInstance;
107         LPCWSTR         lpstrFilter;
108         LPWSTR          lpstrCustomFilter;
109         DWORD           nMaxCustFilter;
110         DWORD           nFilterIndex;
111         LPWSTR          lpstrFile;
112         DWORD           nMaxFile;
113         LPWSTR          lpstrFileTitle;
114         DWORD           nMaxFileTitle;
115         LPCWSTR         lpstrInitialDir;
116         LPCWSTR         lpstrTitle;
117         DWORD           Flags;
118         WORD            nFileOffset;
119         WORD            nFileExtension;
120         LPCWSTR         lpstrDefExt;
121         LPARAM          lCustData;
122         LPOFNHOOKPROC   lpfnHook;
123         LPCWSTR         lpTemplateName;
124         void           *pvReserved;
125         DWORD           dwReserved;
126         DWORD           FlagsEx;
127 } OPENFILENAMEW,*LPOPENFILENAMEW;
128
129 DECL_WINELIB_TYPE_AW(OPENFILENAME)
130 DECL_WINELIB_TYPE_AW(LPOPENFILENAME)
131
132 #ifndef CDSIZEOF_STRUCT
133 #define CDSIZEOF_STRUCT(type,field) ((INT_PTR)&(((type *)0)->field) + sizeof(((type*)0)->field))
134 #endif
135
136 #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName)
137 #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName)
138 #define OPENFILENAME_SIZE_VERSION_400 WINELIB_NAME_AW(OPENFILENAME_SIZE_VERSION_400)
139
140
141 typedef struct
142 {
143         NMHDR           hdr;
144         LPOPENFILENAMEA lpOFN;
145         LPSTR           pszFile;
146 } OFNOTIFYA, *LPOFNOTIFYA;
147
148 typedef struct
149 {
150         NMHDR           hdr;
151         LPOPENFILENAMEW lpOFN;
152         LPWSTR          pszFile;
153 } OFNOTIFYW, *LPOFNOTIFYW;
154
155 DECL_WINELIB_TYPE_AW(OFNOTIFY)
156 DECL_WINELIB_TYPE_AW(LPOFNOTIFY)
157
158 typedef struct _OFNOTIFYEXA
159 {
160         NMHDR           hdr;
161         LPOPENFILENAMEA lpOFN;
162         LPVOID          psf;
163         LPVOID          pidl;
164 } OFNOTIFYEXA, *LPOFNOTIFYEXA;
165
166 typedef struct _OFNOTIFYEXW
167 {
168         NMHDR           hdr;
169         LPOPENFILENAMEW lpOFN;
170         LPVOID          psf;
171         LPVOID          pidl;
172 } OFNOTIFYEXW, *LPOFNOTIFYEXW;
173
174 DECL_WINELIB_TYPE_AW(OFNOTIFYEX)
175 DECL_WINELIB_TYPE_AW(LPOFNOTIFYEX)
176
177 typedef UINT_PTR (CALLBACK *LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
178
179 typedef struct {
180         DWORD           lStructSize;
181         HWND            hwndOwner;
182         HWND            hInstance; /* Should be an HINSTANCE but MS made a typo */
183         DWORD           rgbResult;
184         LPDWORD         lpCustColors;
185         DWORD           Flags;
186         DWORD           lCustData;
187         LPCCHOOKPROC    lpfnHook;
188         LPCSTR          lpTemplateName;
189 } CHOOSECOLORA;
190 typedef CHOOSECOLORA *LPCHOOSECOLORA;
191
192 typedef struct {
193         DWORD           lStructSize;
194         HWND            hwndOwner;
195         HWND            hInstance; /* Should be an HINSTANCE but MS made a typo */
196         DWORD           rgbResult;
197         LPDWORD         lpCustColors;
198         DWORD           Flags;
199         DWORD           lCustData;
200         LPCCHOOKPROC    lpfnHook;
201         LPCWSTR         lpTemplateName;
202 } CHOOSECOLORW;
203 typedef CHOOSECOLORW *LPCHOOSECOLORW;
204
205 DECL_WINELIB_TYPE_AW(CHOOSECOLOR)
206 DECL_WINELIB_TYPE_AW(LPCHOOSECOLOR)
207
208
209 #define CC_RGBINIT               0x00000001
210 #define CC_FULLOPEN              0x00000002
211 #define CC_PREVENTFULLOPEN       0x00000004
212 #define CC_SHOWHELP              0x00000008
213 #define CC_ENABLEHOOK            0x00000010
214 #define CC_ENABLETEMPLATE        0x00000020
215 #define CC_ENABLETEMPLATEHANDLE  0x00000040
216 #define CC_SOLIDCOLOR            0x00000080
217 #define CC_ANYCOLOR              0x00000100
218
219 typedef UINT_PTR (CALLBACK *LPFRHOOKPROC)(HWND,UINT,WPARAM,LPARAM);
220
221 typedef struct {
222         DWORD           lStructSize;
223         HWND            hwndOwner;
224         HINSTANCE       hInstance;
225         DWORD           Flags;
226         LPSTR           lpstrFindWhat;
227         LPSTR           lpstrReplaceWith;
228         WORD            wFindWhatLen;
229         WORD            wReplaceWithLen;
230         LPARAM          lCustData;
231         LPFRHOOKPROC    lpfnHook;
232         LPCSTR          lpTemplateName;
233 } FINDREPLACEA, *LPFINDREPLACEA;
234
235 typedef struct {
236         DWORD           lStructSize;
237         HWND            hwndOwner;
238         HINSTANCE       hInstance;
239         DWORD           Flags;
240         LPWSTR          lpstrFindWhat;
241         LPWSTR          lpstrReplaceWith;
242         WORD            wFindWhatLen;
243         WORD            wReplaceWithLen;
244         LPARAM          lCustData;
245         LPFRHOOKPROC    lpfnHook;
246         LPCWSTR         lpTemplateName;
247 } FINDREPLACEW, *LPFINDREPLACEW;
248
249 DECL_WINELIB_TYPE_AW(FINDREPLACE)
250 DECL_WINELIB_TYPE_AW(LPFINDREPLACE)
251
252 #define FR_DOWN                         0x00000001
253 #define FR_WHOLEWORD                    0x00000002
254 #define FR_MATCHCASE                    0x00000004
255 #define FR_FINDNEXT                     0x00000008
256 #define FR_REPLACE                      0x00000010
257 #define FR_REPLACEALL                   0x00000020
258 #define FR_DIALOGTERM                   0x00000040
259 #define FR_SHOWHELP                     0x00000080
260 #define FR_ENABLEHOOK                   0x00000100
261 #define FR_ENABLETEMPLATE               0x00000200
262 #define FR_NOUPDOWN                     0x00000400
263 #define FR_NOMATCHCASE                  0x00000800
264 #define FR_NOWHOLEWORD                  0x00001000
265 #define FR_ENABLETEMPLATEHANDLE         0x00002000
266 #define FR_HIDEUPDOWN                   0x00004000
267 #define FR_HIDEMATCHCASE                0x00008000
268 #define FR_HIDEWHOLEWORD                0x00010000
269 #define FR_MATCHDIAC                    0x20000000
270 #define FR_MATCHKASHIDA                 0x40000000
271 #define FR_MATCHALEFHAMZA               0x80000000
272
273 typedef UINT_PTR (CALLBACK *LPCFHOOKPROC)(HWND,UINT,WPARAM,LPARAM);
274
275 typedef struct tagCHOOSEFONTA
276 {
277         UINT    lStructSize;
278         HWND            hwndOwner;
279         HDC             hDC;
280         LPLOGFONTA    lpLogFont;
281         INT             iPointSize;
282         DWORD           Flags;
283         COLORREF        rgbColors;
284         LPARAM          lCustData;
285         LPCFHOOKPROC    lpfnHook;
286         LPCSTR          lpTemplateName;
287         HINSTANCE       hInstance;
288         LPSTR           lpszStyle;
289         WORD            nFontType;
290         WORD    ___MISSING_ALIGNMENT__;
291         INT     nSizeMin;
292         INT             nSizeMax;
293 } CHOOSEFONTA, *LPCHOOSEFONTA;
294
295 typedef struct tagCHOOSEFONTW
296 {
297         UINT    lStructSize;
298         HWND            hwndOwner;
299         HDC             hDC;
300         LPLOGFONTW    lpLogFont;
301         INT             iPointSize;
302         DWORD           Flags;
303         COLORREF        rgbColors;
304         LPARAM          lCustData;
305         LPCFHOOKPROC    lpfnHook;
306         LPCWSTR         lpTemplateName;
307         HINSTANCE       hInstance;
308         LPWSTR          lpszStyle;
309         WORD            nFontType;
310         WORD    ___MISSING_ALIGNMENT__;
311         INT     nSizeMin;
312         INT             nSizeMax;
313 } CHOOSEFONTW, *LPCHOOSEFONTW;
314
315 DECL_WINELIB_TYPE_AW(CHOOSEFONT)
316 DECL_WINELIB_TYPE_AW(LPCHOOSEFONT)
317
318 #define CF_SCREENFONTS               0x00000001
319 #define CF_PRINTERFONTS              0x00000002
320 #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
321 #define CF_SHOWHELP                  __MSABI_LONG(0x00000004)
322 #define CF_ENABLEHOOK                __MSABI_LONG(0x00000008)
323 #define CF_ENABLETEMPLATE            __MSABI_LONG(0x00000010)
324 #define CF_ENABLETEMPLATEHANDLE      __MSABI_LONG(0x00000020)
325 #define CF_INITTOLOGFONTSTRUCT       __MSABI_LONG(0x00000040)
326 #define CF_USESTYLE                  __MSABI_LONG(0x00000080)
327 #define CF_EFFECTS                   __MSABI_LONG(0x00000100)
328 #define CF_APPLY                     __MSABI_LONG(0x00000200)
329 #define CF_ANSIONLY                  __MSABI_LONG(0x00000400)
330 #define CF_SCRIPTSONLY               CF_ANSIONLY
331 #define CF_NOVECTORFONTS             __MSABI_LONG(0x00000800)
332 #define CF_NOOEMFONTS                CF_NOVECTORFONTS
333 #define CF_NOSIMULATIONS             __MSABI_LONG(0x00001000)
334 #define CF_LIMITSIZE                 __MSABI_LONG(0x00002000)
335 #define CF_FIXEDPITCHONLY            __MSABI_LONG(0x00004000)
336 #define CF_WYSIWYG                   __MSABI_LONG(0x00008000) /* use with CF_SCREENFONTS & CF_PRINTERFONTS */
337 #define CF_FORCEFONTEXIST            __MSABI_LONG(0x00010000)
338 #define CF_SCALABLEONLY              __MSABI_LONG(0x00020000)
339 #define CF_TTONLY                    __MSABI_LONG(0x00040000)
340 #define CF_NOFACESEL                 __MSABI_LONG(0x00080000)
341 #define CF_NOSTYLESEL                __MSABI_LONG(0x00100000)
342 #define CF_NOSIZESEL                 __MSABI_LONG(0x00200000)
343 #define CF_SELECTSCRIPT              __MSABI_LONG(0x00400000)
344 #define CF_NOSCRIPTSEL               __MSABI_LONG(0x00800000)
345 #define CF_NOVERTFONTS               __MSABI_LONG(0x01000000)
346
347 #define SIMULATED_FONTTYPE      0x8000
348 #define PRINTER_FONTTYPE        0x4000
349 #define SCREEN_FONTTYPE         0x2000
350 #define BOLD_FONTTYPE           0x0100
351 #define ITALIC_FONTTYPE         0x0200
352 #define REGULAR_FONTTYPE        0x0400
353
354 #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
355 #define WM_CHOOSEFONT_SETLOGFONT        (WM_USER + 101)
356 #define WM_CHOOSEFONT_SETFLAGS          (WM_USER + 102)
357
358 #define LBSELCHSTRINGA  "commdlg_LBSelChangedNotify"
359 #if defined(__GNUC__)
360 # define LBSELCHSTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
361   'L','B','S','e','l','C','h','a','n','g','e','d','N','o','t','i','f','y',0 }
362 #elif defined(_MSC_VER)
363 # define LBSELCHSTRINGW L"commdlg_LBSelChangedNotify"
364 #else
365 static const WCHAR LBSELCHSTRINGW[] = { 'c','o','m','m','d','l','g','_',
366   'L','B','S','e','l','C','h','a','n','g','e','d','N','o','t','i','f','y',0 };
367 #endif
368 #define LBSELCHSTRING   WINELIB_NAME_AW(LBSELCHSTRING)
369
370 #define SHAREVISTRINGA  "commdlg_ShareViolation"
371 #if defined(__GNUC__)
372 # define SHAREVISTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
373   'S','h','a','r','e','V','i','o','l','a','t','i','o','n',0 }
374 #elif defined(_MSC_VER)
375 # define SHAREVISTRINGW L"commdlg_ShareViolation"
376 #else
377 static const WCHAR SHAREVISTRINGW[] = { 'c','o','m','m','d','l','g','_',
378   'S','h','a','r','e','V','i','o','l','a','t','i','o','n',0 };
379 #endif
380 #define SHAREVISTRING   WINELIB_NAME_AW(SHAREVISTRING)
381
382 #define FILEOKSTRINGA   "commdlg_FileNameOK"
383 #if defined(__GNUC__)
384 # define FILEOKSTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
385   'F','i','l','e','N','a','m','e','O','K',0 }
386 #elif defined(_MSC_VER)
387 # define FILEOKSTRINGW  L"commdlg_FileNameOK"
388 #else
389 static const WCHAR FILEOKSTRINGW[] = { 'c','o','m','m','d','l','g','_',
390   'F','i','l','e','N','a','m','e','O','K',0 };
391 #endif
392 #define FILEOKSTRING    WINELIB_NAME_AW(FILEOKSTRING)
393
394 #define COLOROKSTRINGA  "commdlg_ColorOK"
395 #if defined(__GNUC__)
396 # define COLOROKSTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
397   'C','o','l','o','r','O','K',0 }
398 #elif defined(_MSC_VER)
399 # define COLOROKSTRINGW L"commdlg_ColorOK"
400 #else
401 static const WCHAR COLOROKSTRINGW[] = { 'c','o','m','m','d','l','g','_',
402   'C','o','l','o','r','O','K',0 };
403 #endif
404 #define COLOROKSTRING   WINELIB_NAME_AW(COLOROKSTRING)
405
406 #define SETRGBSTRINGA   "commdlg_SetRGBColor"
407 #if defined(__GNUC__)
408 # define SETRGBSTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
409   'S','e','t','R','G','B','C','o','l','o','r',0 }
410 #elif defined(_MSC_VER)
411 # define SETRGBSTRINGW  L"commdlg_SetRGBColor"
412 #else
413 static const WCHAR SETRGBSTRINGW[] = { 'c','o','m','m','d','l','g','_',
414   'S','e','t','R','G','B','C','o','l','o','r',0 };
415 #endif
416 #define SETRGBSTRING    WINELIB_NAME_AW(SETRGBSTRING)
417
418 #define FINDMSGSTRINGA  "commdlg_FindReplace"
419 #if defined(__GNUC__)
420 # define FINDMSGSTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
421   'F','i','n','d','R','e','p','l','a','c','e',0 }
422 #elif defined(_MSC_VER)
423 # define FINDMSGSTRINGW L"commdlg_FindReplace"
424 #else
425 static const WCHAR FINDMSGSTRINGW[] = { 'c','o','m','m','d','l','g','_',
426   'F','i','n','d','R','e','p','l','a','c','e',0 };
427 #endif
428 #define FINDMSGSTRING   WINELIB_NAME_AW(FINDMSGSTRING)
429
430 #define HELPMSGSTRINGA  "commdlg_help"
431 #if defined(__GNUC__)
432 # define HELPMSGSTRINGW (const WCHAR []){ 'c','o','m','m','d','l','g','_', \
433   'H','e','l','p',0 }
434 #elif defined(_MSC_VER)
435 # define HELPMSGSTRINGW L"commdlg_help"
436 #else
437 static const WCHAR HELPMSGSTRINGW[] = { 'c','o','m','m','d','l','g','_',
438   'H','e','l','p',0 };
439 #endif
440 #define HELPMSGSTRING   WINELIB_NAME_AW(HELPMSGSTRING)
441
442 #define CD_LBSELNOITEMS -1
443 #define CD_LBSELCHANGE   0
444 #define CD_LBSELSUB      1
445 #define CD_LBSELADD      2
446
447 #define CDN_FIRST   (0U-601U)
448 #define CDN_LAST    (0U-699U)
449
450 #define CDN_INITDONE            (CDN_FIRST - 0x0000)
451 #define CDN_SELCHANGE           (CDN_FIRST - 0x0001)
452 #define CDN_FOLDERCHANGE        (CDN_FIRST - 0x0002)
453 #define CDN_SHAREVIOLATION      (CDN_FIRST - 0x0003)
454 #define CDN_HELP                (CDN_FIRST - 0x0004)
455 #define CDN_FILEOK              (CDN_FIRST - 0x0005)
456 #define CDN_TYPECHANGE          (CDN_FIRST - 0x0006)
457 #define CDN_INCLUDEITEM         (CDN_FIRST - 0x0007)
458
459 #define CDM_FIRST               (WM_USER + 100)
460 #define CDM_LAST                (WM_USER + 200)
461
462 #define CDM_GETSPEC             (CDM_FIRST + 0x0000)
463 #define CDM_GETFILEPATH         (CDM_FIRST + 0x0001)
464 #define CDM_GETFOLDERPATH       (CDM_FIRST + 0x0002)
465 #define CDM_GETFOLDERIDLIST     (CDM_FIRST + 0x0003)
466 #define CDM_SETCONTROLTEXT      (CDM_FIRST + 0x0004)
467 #define CDM_HIDECONTROL         (CDM_FIRST + 0x0005)
468 #define CDM_SETDEFEXT           (CDM_FIRST + 0x0006)
469
470
471 /* Messages to query information from the open or save dialogs */
472
473 #define CommDlg_OpenSave_GetSpecA(_hdlg, _psz, _cbmax) \
474         (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
475 #define CommDlg_OpenSave_GetSpecW(_hdlg, _psz, _cbmax) \
476         (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
477 #define CommDlg_OpenSave_GetSpec  WINELIB_NAME_AW(CommDlg_OpenSave_GetSpec)
478
479 #define CommDlg_OpenSave_GetFilePathA(_hdlg, _psz, _cbmax) \
480         (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
481 #define CommDlg_OpenSave_GetFilePathW(_hdlg, _psz, _cbmax) \
482         (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
483 #define CommDlg_OpenSave_GetFilePath  WINELIB_NAME_AW(CommDlg_OpenSave_GetFilePath)
484
485 #define CommDlg_OpenSave_GetFolderPathA(_hdlg, _psz, _cbmax) \
486         (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
487 #define CommDlg_OpenSave_GetFolderPathW(_hdlg, _psz, _cbmax) \
488         (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
489 #define CommDlg_OpenSave_GetFolderPath  WINELIB_NAME_AW(CommDlg_OpenSave_GetFolderPath)
490
491 #define CommDlg_OpenSave_GetFolderIDList(_hdlg, _pidl, _cbmax) \
492         (int)SNDMSG(_hdlg, CDM_GETFOLDERIDLIST, (WPARAM)_cbmax, (LPARAM)(LPVOID)_pidl)
493
494 #define CommDlg_OpenSave_SetControlText(_hdlg, _id, _text) \
495         (void)SNDMSG(_hdlg, CDM_SETCONTROLTEXT, (WPARAM)_id, (LPARAM)(LPSTR)_text)
496
497 #define CommDlg_OpenSave_HideControl(_hdlg, _id) \
498         (void)SNDMSG(_hdlg, CDM_HIDECONTROL, (WPARAM)_id, 0)
499
500 #define CommDlg_OpenSave_SetDefExt(_hdlg, _pszext) \
501         (void)SNDMSG(_hdlg, CDM_SETDEFEXT, 0, (LPARAM)(LPSTR)_pszext)
502
503 #define CommDlg_OpenSave_GetSpecA(_hdlg, _psz, _cbmax) \
504         (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
505 #define CommDlg_OpenSave_GetSpecW(_hdlg, _psz, _cbmax) \
506         (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
507 #define CommDlg_OpenSave_GetSpec WINELIB_NAME_AW(CommDlg_OpenSave_GetSpec)
508
509 #define CommDlg_OpenSave_GetFilePathA(_hdlg, _psz, _cbmax) \
510         (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
511 #define CommDlg_OpenSave_GetFilePathW(_hdlg, _psz, _cbmax) \
512         (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
513 #define CommDlg_OpenSave_GetFilePath WINELIB_NAME_AW(CommDlg_OpenSave_GetFilePath)
514
515 #define CommDlg_OpenSave_GetFolderPathA(_hdlg, _psz, _cbmax) \
516         (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
517 #define CommDlg_OpenSave_GetFolderPathW(_hdlg, _psz, _cbmax) \
518         (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
519 #define CommDlg_OpenSave_GetFolderPath WINELIB_NAME_AW(CommDlg_OpenSave_GetFolderPath)
520
521 #define CommDlg_OpenSave_GetFolderIDList(_hdlg, _pidl, _cbmax) \
522         (int)SNDMSG(_hdlg, CDM_GETFOLDERIDLIST, (WPARAM)_cbmax, (LPARAM)(LPVOID)_pidl)
523
524 #define CommDlg_OpenSave_SetControlText(_hdlg, _id, _text) \
525         (void)SNDMSG(_hdlg, CDM_SETCONTROLTEXT, (WPARAM)_id, (LPARAM)(LPSTR)_text)
526
527 #define CommDlg_OpenSave_HideControl(_hdlg, _id) \
528         (void)SNDMSG(_hdlg, CDM_HIDECONTROL, (WPARAM)_id, 0)
529
530 #define CommDlg_OpenSave_SetDefExt(_hdlg, _pszext) \
531         (void)SNDMSG(_hdlg, CDM_SETDEFEXT, 0, (LPARAM)(LPSTR)_pszext)
532
533
534 typedef UINT (CALLBACK *LPPRINTHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
535 typedef UINT (CALLBACK *LPSETUPHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
536
537 typedef struct tagPDA
538 {
539     DWORD            lStructSize;
540     HWND           hwndOwner;
541     HGLOBAL        hDevMode;
542     HGLOBAL        hDevNames;
543     HDC            hDC;
544     DWORD            Flags;
545     WORD             nFromPage;
546     WORD             nToPage;
547     WORD             nMinPage;
548     WORD             nMaxPage;
549     WORD             nCopies;
550     HINSTANCE      hInstance;
551     LPARAM           lCustData;
552     LPPRINTHOOKPROC  lpfnPrintHook;
553     LPSETUPHOOKPROC  lpfnSetupHook;
554     LPCSTR           lpPrintTemplateName;
555     LPCSTR           lpSetupTemplateName;
556     HGLOBAL        hPrintTemplate;
557     HGLOBAL        hSetupTemplate;
558 } PRINTDLGA, *LPPRINTDLGA;
559
560 typedef struct tagPDW
561 {
562     DWORD            lStructSize;
563     HWND           hwndOwner;
564     HGLOBAL        hDevMode;
565     HGLOBAL        hDevNames;
566     HDC            hDC;
567     DWORD            Flags;
568     WORD             nFromPage;
569     WORD             nToPage;
570     WORD             nMinPage;
571     WORD             nMaxPage;
572     WORD             nCopies;
573     HINSTANCE      hInstance;
574     LPARAM           lCustData;
575     LPPRINTHOOKPROC  lpfnPrintHook;
576     LPSETUPHOOKPROC  lpfnSetupHook;
577     LPCWSTR          lpPrintTemplateName;
578     LPCWSTR          lpSetupTemplateName;
579     HGLOBAL        hPrintTemplate;
580     HGLOBAL        hSetupTemplate;
581 } PRINTDLGW, *LPPRINTDLGW;
582
583 DECL_WINELIB_TYPE_AW(PRINTDLG)
584 DECL_WINELIB_TYPE_AW(LPPRINTDLG)
585
586 #define PD_ALLPAGES                   0x00000000
587 #define PD_SELECTION                  0x00000001
588 #define PD_PAGENUMS                   0x00000002
589 #define PD_NOSELECTION                0x00000004
590 #define PD_NOPAGENUMS                 0x00000008
591 #define PD_COLLATE                    0x00000010
592 #define PD_PRINTTOFILE                0x00000020
593 #define PD_PRINTSETUP                 0x00000040
594 #define PD_NOWARNING                  0x00000080
595 #define PD_RETURNDC                   0x00000100
596 #define PD_RETURNIC                   0x00000200
597 #define PD_RETURNDEFAULT              0x00000400
598 #define PD_SHOWHELP                   0x00000800
599 #define PD_ENABLEPRINTHOOK            0x00001000
600 #define PD_ENABLESETUPHOOK            0x00002000
601 #define PD_ENABLEPRINTTEMPLATE        0x00004000
602 #define PD_ENABLESETUPTEMPLATE        0x00008000
603 #define PD_ENABLEPRINTTEMPLATEHANDLE  0x00010000
604 #define PD_ENABLESETUPTEMPLATEHANDLE  0x00020000
605 #define PD_USEDEVMODECOPIES           0x00040000
606 #define PD_USEDEVMODECOPIESANDCOLLATE 0x00040000
607 #define PD_DISABLEPRINTTOFILE         0x00080000
608 #define PD_HIDEPRINTTOFILE            0x00100000
609 #define PD_NONETWORKBUTTON            0x00200000
610 #define PD_CURRENTPAGE                0x00400000
611 #define PD_NOCURRENTPAGE              0x00800000
612 #define PD_EXCLUSIONFLAGS             0x01000000
613 #define PD_USELARGETEMPLATE           0x10000000
614
615
616 #define PD_EXCL_COPIESANDCOLLATE      (DM_COPIES | DM_COLLATE)
617
618 #define START_PAGE_GENERAL 0xffffffff
619
620 #define PD_RESULT_CANCEL 0
621 #define PD_RESULT_PRINT  1
622 #define PD_RESULT_APPLY  2
623
624 typedef struct
625 {
626     WORD  wDriverOffset;
627     WORD  wDeviceOffset;
628     WORD  wOutputOffset;
629     WORD  wDefault;
630 } DEVNAMES;
631 typedef DEVNAMES * LPDEVNAMES;
632
633 #define DN_DEFAULTPRN      0x0001
634
635 /* PageSetupDlg stuff ... */
636 #define WM_PSD_PAGESETUPDLG     (WM_USER  )
637 #define WM_PSD_FULLPAGERECT     (WM_USER+1)
638 #define WM_PSD_MINMARGINRECT    (WM_USER+2)
639 #define WM_PSD_MARGINRECT       (WM_USER+3)
640 #define WM_PSD_GREEKTEXTRECT    (WM_USER+4)
641 #define WM_PSD_ENVSTAMPRECT     (WM_USER+5)
642 #define WM_PSD_YAFULLPAGERECT   (WM_USER+6)
643
644 typedef UINT (CALLBACK *LPPAGEPAINTHOOK)( HWND, UINT, WPARAM, LPARAM );
645 typedef UINT (CALLBACK *LPPAGESETUPHOOK)( HWND, UINT, WPARAM, LPARAM );
646
647 typedef struct tagPSDA
648 {
649         DWORD           lStructSize;
650         HWND            hwndOwner;
651         HGLOBAL hDevMode;
652         HGLOBAL hDevNames;
653         DWORD           Flags;
654         POINT           ptPaperSize;
655         RECT            rtMinMargin;
656         RECT            rtMargin;
657         HINSTANCE       hInstance;
658         LPARAM          lCustData;
659         LPPAGESETUPHOOK lpfnPageSetupHook;
660         LPPAGEPAINTHOOK lpfnPagePaintHook;
661         LPCSTR          lpPageSetupTemplateName;
662         HGLOBAL hPageSetupTemplate;
663 } PAGESETUPDLGA,*LPPAGESETUPDLGA;
664
665 typedef struct tagPSDW
666 {
667         DWORD           lStructSize;
668         HWND            hwndOwner;
669         HGLOBAL hDevMode;
670         HGLOBAL hDevNames;
671         DWORD           Flags;
672         POINT           ptPaperSize;
673         RECT            rtMinMargin;
674         RECT            rtMargin;
675         HINSTANCE       hInstance;
676         LPARAM          lCustData;
677         LPPAGESETUPHOOK lpfnPageSetupHook;
678         LPPAGEPAINTHOOK lpfnPagePaintHook;
679         LPCWSTR         lpPageSetupTemplateName;
680         HGLOBAL hPageSetupTemplate;
681 } PAGESETUPDLGW,*LPPAGESETUPDLGW;
682 DECL_WINELIB_TYPE_AW(PAGESETUPDLG)
683 DECL_WINELIB_TYPE_AW(LPPAGESETUPDLG)
684
685 #define PSD_DEFAULTMINMARGINS             0x00000000
686 #define PSD_INWININIINTLMEASURE           0x00000000
687
688 #define PSD_MINMARGINS                    0x00000001
689 #define PSD_MARGINS                       0x00000002
690 #define PSD_INTHOUSANDTHSOFINCHES         0x00000004
691 #define PSD_INHUNDREDTHSOFMILLIMETERS     0x00000008
692 #define PSD_DISABLEMARGINS                0x00000010
693 #define PSD_DISABLEPRINTER                0x00000020
694 #define PSD_NOWARNING                     0x00000080
695 #define PSD_DISABLEORIENTATION            0x00000100
696 #define PSD_RETURNDEFAULT                 0x00000400
697 #define PSD_DISABLEPAPER                  0x00000200
698 #define PSD_SHOWHELP                      0x00000800
699 #define PSD_ENABLEPAGESETUPHOOK           0x00002000
700 #define PSD_ENABLEPAGESETUPTEMPLATE       0x00008000
701 #define PSD_ENABLEPAGESETUPTEMPLATEHANDLE 0x00020000
702 #define PSD_ENABLEPAGEPAINTHOOK           0x00040000
703 #define PSD_DISABLEPAGEPAINTING           0x00080000
704 #define PSD_NONETWORKBUTTON               0x00200000
705
706 typedef struct tagPRINTPAGERANGE
707 {
708     DWORD       nFromPage;
709     DWORD       nToPage;
710 } PRINTPAGERANGE, *LPPRINTPAGERANGE;
711
712 typedef struct tagPDEXA
713 {
714     DWORD               lStructSize;
715     HWND                hwndOwner;
716     HGLOBAL             hDevMode;
717     HGLOBAL             hDevNames;
718     HDC                 hDC;
719     DWORD               Flags;
720     DWORD               Flags2;
721     DWORD               ExclusionFlags;
722     DWORD               nPageRanges;
723     DWORD               nMaxPageRanges;
724     LPPRINTPAGERANGE    lpPageRanges;
725     DWORD               nMinPage;
726     DWORD               nMaxPage;
727     DWORD               nCopies;
728     HINSTANCE           hInstance;
729     LPCSTR              lpPrintTemplateName;
730     void* /*LPUNKNOWN*/ lpCallback;
731     DWORD               nPropertyPages;
732     HPROPSHEETPAGE*     lphPropertyPages;
733     DWORD               nStartPage;
734     DWORD               dwResultAction;
735 } PRINTDLGEXA, *LPPRINTDLGEXA;
736
737 typedef struct tagPDEXW
738 {
739     DWORD               lStructSize;
740     HWND                hwndOwner;
741     HGLOBAL             hDevMode;
742     HGLOBAL             hDevNames;
743     HDC                 hDC;
744     DWORD               Flags;
745     DWORD               Flags2;
746     DWORD               ExclusionFlags;
747     DWORD               nPageRanges;
748     DWORD               nMaxPageRanges;
749     LPPRINTPAGERANGE    lpPageRanges;
750     DWORD               nMinPage;
751     DWORD               nMaxPage;
752     DWORD               nCopies;
753     HINSTANCE           hInstance;
754     LPCWSTR             lpPrintTemplateName;
755     void* /*LPUNKNOWN*/ lpCallback;
756     DWORD               nPropertyPages;
757     HPROPSHEETPAGE*     lphPropertyPages;
758     DWORD               nStartPage;
759     DWORD               dwResultAction;
760 } PRINTDLGEXW, *LPPRINTDLGEXW;
761
762 DECL_WINELIB_TYPE_AW(PRINTDLGEX)
763 DECL_WINELIB_TYPE_AW(LPPRINTDLGEX)
764
765 BOOL  WINAPI ChooseColorA(LPCHOOSECOLORA lpChCol);
766 BOOL  WINAPI ChooseColorW(LPCHOOSECOLORW lpChCol);
767 #define ChooseColor WINELIB_NAME_AW(ChooseColor)
768 DWORD   WINAPI CommDlgExtendedError(void);
769 HWND  WINAPI FindTextA(LPFINDREPLACEA lpFind);
770 HWND  WINAPI FindTextW(LPFINDREPLACEW lpFind);
771 #define FindText WINELIB_NAME_AW(FindText)
772 short   WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, WORD cbBuf);
773 short   WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf);
774 #define GetFileTitle WINELIB_NAME_AW(GetFileTitle)
775 BOOL  WINAPI GetOpenFileNameA(LPOPENFILENAMEA ofn);
776 BOOL  WINAPI GetOpenFileNameW(LPOPENFILENAMEW ofn);
777 #define GetOpenFileName WINELIB_NAME_AW(GetOpenFileName)
778 BOOL  WINAPI GetSaveFileNameA(LPOPENFILENAMEA ofn);
779 BOOL  WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn);
780 #define GetSaveFileName WINELIB_NAME_AW(GetSaveFileName)
781 BOOL WINAPI PageSetupDlgA( LPPAGESETUPDLGA );
782 BOOL WINAPI PageSetupDlgW( LPPAGESETUPDLGW );
783 #define PageSetupDlg WINELIB_NAME_AW(PageSetupDlg)
784 BOOL  WINAPI PrintDlgA( LPPRINTDLGA printdlg);
785 BOOL  WINAPI PrintDlgW( LPPRINTDLGW printdlg);
786 #define PrintDlg WINELIB_NAME_AW(PrintDlg)
787 HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA);
788 HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW);
789 #define PrintDlgEx WINELIB_NAME_AW(PrintDlgEx)
790 HWND  WINAPI ReplaceTextA( LPFINDREPLACEA lpFind);
791 HWND  WINAPI ReplaceTextW( LPFINDREPLACEW lpFind);
792 #define ReplaceText WINELIB_NAME_AW(ReplaceText)
793 BOOL  WINAPI ChooseFontA(LPCHOOSEFONTA);
794 BOOL  WINAPI ChooseFontW(LPCHOOSEFONTW);
795 #define ChooseFont WINELIB_NAME_AW(ChooseFont)
796
797 void COMDLG32_SetCommDlgExtendedError(DWORD err);
798
799
800 #ifndef _WIN64
801 #include <poppack.h>
802 #endif
803
804 #ifdef __cplusplus
805 }
806 #endif
807
808 #endif  /* __WINE_COMMDLG_H */