winedbg: Fix "floating pointer" typo.
[wine] / programs / progman / dialog.c
1 /*
2  * Program Manager
3  *
4  * Copyright 1996 Ulrich Schmid
5  * Copyright 2002 Sylvain Petreolle
6  * Copyright 2002 Andriy Palamarchuk
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #define WIN32_LEAN_AND_MEAN
24
25 #include "windows.h"
26 #include "commdlg.h"
27 #include "progman.h"
28 static BOOL    DIALOG_BrowsePrograms(HWND, LPSTR, INT);
29 static BOOL    DIALOG_BrowseSymbols(HWND, LPSTR, INT);
30 static INT_PTR CALLBACK DIALOG_NEW_DlgProc(HWND, UINT, WPARAM, LPARAM);
31 static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND, UINT, WPARAM, LPARAM);
32 static INT_PTR CALLBACK DIALOG_GROUP_DlgProc(HWND, UINT, WPARAM, LPARAM);
33 static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND, UINT, WPARAM, LPARAM);
34 static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND, UINT, WPARAM, LPARAM);
35 static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc(HWND, UINT, WPARAM, LPARAM);
36
37 /***********************************************************************
38  *
39  *           DIALOG_New
40  */
41
42 static struct
43 {
44   INT nDefault;
45 } New;
46
47 INT DIALOG_New(INT nDefault)
48 {
49   DLGPROC lpfnDlg = MakeProcInstance(DIALOG_NEW_DlgProc, Globals.hInstance);
50   INT ret;
51
52   New.nDefault = nDefault;
53
54   ret = DialogBox(Globals.hInstance,  STRING_NEW,
55                   Globals.hMainWnd, lpfnDlg);
56   FreeProcInstance(lpfnDlg);
57   return ret;
58 }
59
60 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
61  *
62  *           DIALOG_NEW_DlgProc
63  */
64
65 static INT_PTR CALLBACK DIALOG_NEW_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
66 {
67   switch (msg)
68     {
69     case WM_INITDIALOG:
70       CheckRadioButton(hDlg, PM_NEW_GROUP, PM_NEW_PROGRAM, New.nDefault);
71       break;
72
73     case WM_COMMAND:
74       switch (wParam)
75         {
76         case PM_NEW_GROUP:
77         case PM_NEW_PROGRAM:
78           CheckRadioButton(hDlg, PM_NEW_GROUP, PM_NEW_PROGRAM, wParam);
79           return TRUE;
80
81         case IDOK:
82           EndDialog(hDlg, IsDlgButtonChecked(hDlg, PM_NEW_GROUP) ?
83                     PM_NEW_GROUP : PM_NEW_PROGRAM);
84           return TRUE;
85
86         case IDCANCEL:
87           EndDialog(hDlg, IDCANCEL);
88           return TRUE;
89         }
90     }
91   return FALSE;
92 }
93
94 /***********************************************************************
95  *
96  *           DIALOG_CopyMove
97  */
98
99 static struct
100 {
101   LPCSTR lpszProgramName, lpszFromGroupName;
102   HLOCAL hToGroup;
103 } CopyMove;
104
105 HLOCAL DIALOG_CopyMove(LPCSTR lpszProgramName, LPCSTR lpszFromGroupName,
106                      BOOL bMove)
107 {
108   DLGPROC lpfnDlg = MakeProcInstance(DIALOG_COPY_MOVE_DlgProc, Globals.hInstance);
109   INT ret;
110
111   CopyMove.lpszProgramName   = lpszProgramName;
112   CopyMove.lpszFromGroupName = lpszFromGroupName;
113   CopyMove.hToGroup          = 0;
114
115   ret = DialogBox(Globals.hInstance,
116                   bMove ? STRING_MOVE : STRING_COPY,
117                   Globals.hMainWnd, lpfnDlg);
118   FreeProcInstance(lpfnDlg);
119
120   return((ret == IDOK) ? CopyMove.hToGroup : 0);
121 }
122
123 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
124  *
125  *           DIALOG_COPY_MOVE_DlgProc
126  */
127
128 static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
129 {
130   HLOCAL hGroup;
131
132   switch (msg)
133     {
134     case WM_INITDIALOG:
135       /* List all group names */
136       for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup))
137         SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_ADDSTRING, 0,
138                            (LPARAM) GROUP_GroupName(hGroup));
139
140       SetDlgItemText(hDlg, PM_PROGRAM,    CopyMove.lpszProgramName);
141       SetDlgItemText(hDlg, PM_FROM_GROUP, CopyMove.lpszFromGroupName);
142       break;
143
144     case WM_COMMAND:
145       switch (wParam)
146         {
147         case IDOK:
148         {
149           /* Get selected group */
150           INT nCurSel    = SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETCURSEL, 0, 0);
151           INT nLen       = SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETLBTEXTLEN, nCurSel, 0);
152           HLOCAL hBuffer = LocalAlloc(LMEM_FIXED, nLen + 1);
153           LPSTR   buffer = LocalLock(hBuffer);
154
155           SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETLBTEXT, nCurSel, (LPARAM)buffer);
156           for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup))
157             if (!lstrcmp(buffer, GROUP_GroupName(hGroup))) break;
158           LocalFree(hBuffer);
159
160           CopyMove.hToGroup = hGroup;
161           EndDialog(hDlg, IDOK);
162           return TRUE;
163         }
164
165         case IDCANCEL:
166           EndDialog(hDlg, IDCANCEL);
167           return TRUE;
168         }
169     }
170   return FALSE;
171 }
172
173 /***********************************************************************
174  *
175  *           DIALOG_Delete
176  */
177
178 BOOL DIALOG_Delete(UINT ids_text_s, LPCSTR lpszName)
179 {
180   return (IDYES == MAIN_MessageBoxIDS_s(ids_text_s, lpszName, IDS_DELETE,
181                                         MB_YESNO | MB_DEFBUTTON2));
182 }
183
184
185 /***********************************************************************
186  *
187  *           DIALOG_GroupAttributes
188  */
189
190 static struct
191 {
192   LPSTR lpszTitle, lpszGrpFile;
193   INT   nSize;
194 } GroupAttributes;
195
196 BOOL DIALOG_GroupAttributes(LPSTR lpszTitle, LPSTR lpszGrpFile, INT nSize)
197 {
198   DLGPROC lpfnDlg = MakeProcInstance(DIALOG_GROUP_DlgProc, Globals.hInstance);
199   INT ret;
200
201   GroupAttributes.nSize       = nSize;
202   GroupAttributes.lpszTitle   = lpszTitle;
203   GroupAttributes.lpszGrpFile = lpszGrpFile;
204
205   ret = DialogBox(Globals.hInstance,  STRING_GROUP,
206                   Globals.hMainWnd, lpfnDlg);
207   FreeProcInstance(lpfnDlg);
208   return(ret == IDOK);
209 }
210
211 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
212  *
213  *           DIALOG_GROUP_DlgProc
214  */
215
216 static INT_PTR CALLBACK DIALOG_GROUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
217 {
218   switch (msg)
219     {
220     case WM_INITDIALOG:
221       SetDlgItemText(hDlg, PM_DESCRIPTION, GroupAttributes.lpszTitle);
222       SetDlgItemText(hDlg, PM_FILE, GroupAttributes.lpszGrpFile);
223       break;
224
225     case WM_COMMAND:
226       switch (wParam)
227         {
228         case IDOK:
229           GetDlgItemText(hDlg, PM_DESCRIPTION, GroupAttributes.lpszTitle,
230                          GroupAttributes.nSize);
231           GetDlgItemText(hDlg, PM_FILE, GroupAttributes.lpszGrpFile,
232                          GroupAttributes.nSize);
233           EndDialog(hDlg, IDOK);
234           return TRUE;
235
236         case IDCANCEL:
237           EndDialog(hDlg, IDCANCEL);
238           return TRUE;
239         }
240     }
241   return FALSE;
242 }
243
244 /***********************************************************************
245  *
246  *           DIALOG_ProgramAttributes
247  */
248
249 static struct
250 {
251   LPSTR lpszTitle, lpszCmdLine, lpszWorkDir, lpszIconFile, lpszTmpIconFile;
252   INT   nSize;
253   INT   *lpnCmdShow;
254   INT   *lpnHotKey;
255   HWND  hSelGroupWnd;
256   HICON *lphIcon, hTmpIcon;
257   INT   *lpnIconIndex, nTmpIconIndex;
258 } ProgramAttributes;
259
260 BOOL DIALOG_ProgramAttributes(LPSTR lpszTitle, LPSTR lpszCmdLine,
261                               LPSTR lpszWorkDir, LPSTR lpszIconFile,
262                               HICON *lphIcon, INT *lpnIconIndex,
263                               INT *lpnHotKey, INT *lpnCmdShow, INT nSize)
264 {
265   CHAR szTmpIconFile[MAX_PATHNAME_LEN];
266   DLGPROC lpfnDlg = MakeProcInstance(DIALOG_PROGRAM_DlgProc, Globals.hInstance);
267   INT ret;
268
269   ProgramAttributes.nSize = nSize;
270   ProgramAttributes.lpszTitle = lpszTitle;
271   ProgramAttributes.lpszCmdLine = lpszCmdLine;
272   ProgramAttributes.lpszWorkDir = lpszWorkDir;
273   ProgramAttributes.lpszIconFile = lpszIconFile;
274   ProgramAttributes.lpnCmdShow = lpnCmdShow;
275   ProgramAttributes.lpnHotKey = lpnHotKey;
276   ProgramAttributes.lphIcon = lphIcon;
277   ProgramAttributes.lpnIconIndex = lpnIconIndex;
278
279 #if 0
280   ProgramAttributes.hTmpIcon = 0;
281 #else
282   ProgramAttributes.hTmpIcon = *lphIcon;
283 #endif
284   ProgramAttributes.nTmpIconIndex = *lpnIconIndex;
285   ProgramAttributes.lpszTmpIconFile = szTmpIconFile;
286   lstrcpyn(ProgramAttributes.lpszTmpIconFile, lpszIconFile, MAX_PATHNAME_LEN);
287
288   ret = DialogBox(Globals.hInstance,  STRING_PROGRAM,
289                   Globals.hMainWnd, lpfnDlg);
290   FreeProcInstance(lpfnDlg);
291
292   return(ret == IDOK);
293 }
294
295 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
296  *
297  *           DIALOG_PROGRAM_DlgProc
298  */
299
300 static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
301 {
302   CHAR buffer[MAX_STRING_LEN];
303   switch (msg)
304     {
305     case WM_INITDIALOG:
306       SetDlgItemText(hDlg, PM_DESCRIPTION, ProgramAttributes.lpszTitle);
307       SetDlgItemText(hDlg, PM_COMMAND_LINE, ProgramAttributes.lpszCmdLine);
308       SetDlgItemText(hDlg, PM_DIRECTORY, ProgramAttributes.lpszWorkDir);
309       if (!*ProgramAttributes.lpnHotKey)
310         {
311           LoadString(Globals.hInstance, IDS_NO_HOT_KEY, buffer, sizeof(buffer));
312           SetDlgItemText(hDlg, PM_HOT_KEY, buffer);
313         }
314
315       CheckDlgButton(hDlg, PM_SYMBOL,
316                      (*ProgramAttributes.lpnCmdShow == SW_SHOWMINIMIZED));
317       SendDlgItemMessage(hDlg, PM_ICON, STM_SETICON,
318                          (WPARAM) ProgramAttributes.hTmpIcon, 0);
319       break;
320
321     case WM_COMMAND:
322       switch (wParam)
323         {
324         case PM_SYMBOL:
325           CheckDlgButton(hDlg, PM_SYMBOL, !IsDlgButtonChecked(hDlg, PM_SYMBOL));
326           return TRUE;
327
328         case PM_BROWSE:
329           {
330             CHAR filename[MAX_PATHNAME_LEN];
331             filename[0] = 0;
332             if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
333               SetDlgItemText(hDlg, PM_COMMAND_LINE, filename);
334             return TRUE;
335           }
336
337         case PM_OTHER_SYMBOL:
338           {
339             DIALOG_Symbol(&ProgramAttributes.hTmpIcon,
340                           ProgramAttributes.lpszTmpIconFile,
341                           &ProgramAttributes.nTmpIconIndex,
342                           MAX_PATHNAME_LEN);
343
344             SendDlgItemMessage(hDlg, PM_ICON, STM_SETICON,
345                                (WPARAM) ProgramAttributes.hTmpIcon, 0);
346             return TRUE;
347           }
348
349         case IDOK:
350           GetDlgItemText(hDlg, PM_DESCRIPTION,
351                          ProgramAttributes.lpszTitle,
352                          ProgramAttributes.nSize);
353           GetDlgItemText(hDlg, PM_COMMAND_LINE,
354                          ProgramAttributes.lpszCmdLine,
355                          ProgramAttributes.nSize);
356           GetDlgItemText(hDlg, PM_DIRECTORY,
357                          ProgramAttributes.lpszWorkDir,
358                          ProgramAttributes.nSize);
359
360           if (ProgramAttributes.hTmpIcon)
361             {
362 #if 0
363               if (*ProgramAttributes.lphIcon)
364                 DestroyIcon(*ProgramAttributes.lphIcon);
365 #endif
366               *ProgramAttributes.lphIcon = ProgramAttributes.hTmpIcon;
367               *ProgramAttributes.lpnIconIndex = ProgramAttributes.nTmpIconIndex;
368               lstrcpyn(ProgramAttributes.lpszIconFile,
369                        ProgramAttributes.lpszTmpIconFile,
370                        ProgramAttributes.nSize);
371             }
372
373           *ProgramAttributes.lpnCmdShow =
374             IsDlgButtonChecked(hDlg, PM_SYMBOL) ?
375             SW_SHOWMINIMIZED : SW_SHOWNORMAL;
376           EndDialog(hDlg, IDOK);
377           return TRUE;
378
379         case IDCANCEL:
380           EndDialog(hDlg, IDCANCEL);
381           return TRUE;
382         }
383       return FALSE;
384     }
385   return FALSE;
386 }
387
388 /***********************************************************************
389  *
390  *           DIALOG_Symbol
391  */
392
393 static struct
394 {
395   LPSTR  lpszIconFile;
396   INT    nSize;
397   HICON  *lphIcon;
398   INT    *lpnIconIndex;
399 } Symbol;
400
401 VOID DIALOG_Symbol(HICON *lphIcon, LPSTR lpszIconFile,
402                    INT *lpnIconIndex, INT nSize)
403 {
404   DLGPROC lpfnDlg = MakeProcInstance(DIALOG_SYMBOL_DlgProc, Globals.hInstance);
405
406   Symbol.nSize = nSize;
407   Symbol.lpszIconFile = lpszIconFile;
408   Symbol.lphIcon = lphIcon;
409   Symbol.lpnIconIndex = lpnIconIndex;
410
411   DialogBox(Globals.hInstance, STRING_SYMBOL,
412             Globals.hMainWnd, lpfnDlg);
413   FreeProcInstance(lpfnDlg);
414 }
415
416 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
417  *
418  *           DIALOG_SYMBOL_DlgProc
419  */
420
421 static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
422 {
423   switch (msg)
424     {
425     case WM_INITDIALOG:
426       SetDlgItemText(hDlg, PM_ICON_FILE, Symbol.lpszIconFile);
427       SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_SETITEMHEIGHT, 0, (LPARAM) 32);
428       SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_ADDSTRING, 0, (LPARAM)*Symbol.lphIcon);
429       SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_ADDSTRING, 0, (LPARAM)Globals.hDefaultIcon);
430       SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_SETCURSEL, 0, 0);
431       return TRUE;
432
433     case WM_MEASUREITEM:
434       {
435         PMEASUREITEMSTRUCT measure = (PMEASUREITEMSTRUCT) lParam;
436         measure->itemWidth = 32;
437         measure->itemHeight = 32;
438         return TRUE;
439       }
440
441     case WM_DRAWITEM:
442       {
443         PDRAWITEMSTRUCT dis = (PDRAWITEMSTRUCT) lParam;
444         DrawIcon(dis->hDC, dis->rcItem.left, dis->rcItem.top, (HICON)dis->itemData);
445         return TRUE;
446       }
447
448     case WM_COMMAND:
449       switch (wParam)
450         {
451         case PM_BROWSE:
452           {
453             CHAR filename[MAX_PATHNAME_LEN];
454             filename[0] = 0;
455             if (DIALOG_BrowseSymbols(hDlg, filename, sizeof(filename)))
456               SetDlgItemText(hDlg, PM_ICON_FILE, filename);
457             return TRUE;
458           }
459
460         case PM_HELP:
461           MAIN_MessageBoxIDS(IDS_NOT_IMPLEMENTED, IDS_ERROR, MB_OK);
462           return TRUE;
463
464         case IDOK:
465           {
466             INT nCurSel = SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_GETCURSEL, 0, 0);
467
468             GetDlgItemText(hDlg, PM_ICON_FILE, Symbol.lpszIconFile, Symbol.nSize);
469
470             *Symbol.lphIcon = (HICON)SendDlgItemMessage(hDlg, PM_SYMBOL_LIST,
471                                                         CB_GETITEMDATA,
472                                                         (WPARAM) nCurSel, 0);
473 #if 0
474             *Symbol.lphIcon = CopyIcon(*Symbol.lphIcon);
475 #endif
476
477             EndDialog(hDlg, IDOK);
478             return TRUE;
479           }
480
481         case IDCANCEL:
482           EndDialog(hDlg, IDCANCEL);
483           return TRUE;
484         }
485     }
486   return FALSE;
487 }
488
489 /***********************************************************************
490  *
491  *           DIALOG_Execute
492  */
493
494 VOID DIALOG_Execute(void)
495 {
496   INT_PTR z;
497   DLGPROC lpfnDlg = MakeProcInstance(DIALOG_EXECUTE_DlgProc, Globals.hInstance);
498   z=DialogBox(Globals.hInstance, STRING_EXECUTE,
499               Globals.hMainWnd, lpfnDlg);
500               FreeProcInstance(lpfnDlg);
501 }
502
503 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
504  *
505  *           DIALOG_EXECUTE_DlgProc
506  */
507
508 static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc(HWND hDlg, UINT msg,
509                                       WPARAM wParam, LPARAM lParam)
510 {
511   switch (msg)
512     {
513     case WM_COMMAND:
514       switch (wParam)
515         {
516         case PM_SYMBOL:
517           CheckDlgButton(hDlg, PM_SYMBOL, !IsDlgButtonChecked(hDlg, PM_SYMBOL));
518           return TRUE;
519
520         case PM_BROWSE:
521           {
522             CHAR filename[MAX_PATHNAME_LEN];
523             filename[0] = 0;
524             if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
525               SetDlgItemText(hDlg, PM_COMMAND, filename);
526             return TRUE;
527           }
528
529         case PM_HELP:
530           MAIN_MessageBoxIDS(IDS_NOT_IMPLEMENTED, IDS_ERROR, MB_OK);
531           return TRUE;
532
533         case IDOK:
534           {
535             CHAR cmdline[MAX_PATHNAME_LEN];
536             GetDlgItemText(hDlg, PM_COMMAND, cmdline, sizeof(cmdline));
537
538             WinExec(cmdline, IsDlgButtonChecked(hDlg, PM_SYMBOL) ?
539                     SW_SHOWMINIMIZED : SW_SHOWNORMAL);
540             if (Globals.bMinOnRun) CloseWindow(Globals.hMainWnd);
541
542             EndDialog(hDlg, IDOK);
543             return TRUE;
544           }
545
546         case IDCANCEL:
547           EndDialog(hDlg, IDCANCEL);
548           return TRUE;
549         }
550     }
551   return FALSE;
552 }
553
554 /***********************************************************************
555  *
556  *           DIALOG_Browse
557  */
558
559 static BOOL DIALOG_Browse(HWND hDlg, LPCSTR lpszzFilter,
560                           LPSTR lpstrFile, INT nMaxFile)
561
562 {
563     OPENFILENAME openfilename;
564
565     CHAR szDir[MAX_PATH];
566     CHAR szDefaultExt[] = "exe";
567
568     ZeroMemory(&openfilename, sizeof(openfilename));
569
570     GetCurrentDirectory(sizeof(szDir), szDir);
571
572     openfilename.lStructSize       = sizeof(openfilename);
573     openfilename.hwndOwner         = Globals.hMainWnd;
574     openfilename.hInstance         = Globals.hInstance;
575     openfilename.lpstrFilter       = lpszzFilter;
576     openfilename.lpstrFile         = lpstrFile;
577     openfilename.nMaxFile          = nMaxFile;
578     openfilename.lpstrInitialDir   = szDir;
579     openfilename.Flags             = 0;
580     openfilename.lpstrDefExt       = szDefaultExt;
581     openfilename.lpstrCustomFilter = 0;
582     openfilename.nMaxCustFilter    = 0;
583     openfilename.nFilterIndex      = 0;
584     openfilename.lpstrFileTitle    = 0;
585     openfilename.nMaxFileTitle     = 0;
586     openfilename.lpstrInitialDir   = 0;
587     openfilename.lpstrTitle        = 0;
588     openfilename.nFileOffset       = 0;
589     openfilename.nFileExtension    = 0;
590     openfilename.lCustData         = 0;
591     openfilename.lpfnHook          = 0;
592     openfilename.lpTemplateName    = 0;
593
594     return GetOpenFileName(&openfilename);
595 }
596
597 /***********************************************************************
598  *
599  *           DIALOG_AddFilterItem
600  */
601
602 static VOID DIALOG_AddFilterItem(LPSTR *p, UINT ids, LPCSTR filter)
603 {
604   LoadString(Globals.hInstance, ids, *p, MAX_STRING_LEN);
605   *p += strlen(*p) + 1;
606   lstrcpy(*p, filter);
607   *p += strlen(*p) + 1;
608   **p = '\0';
609 }
610
611 /***********************************************************************
612  *
613  *           DIALOG_BrowsePrograms
614  */
615
616 static BOOL DIALOG_BrowsePrograms(HWND hDlg, LPSTR lpszFile, INT nMaxFile)
617 {
618   CHAR  szzFilter[2 * MAX_STRING_LEN + 100];
619   LPSTR p = szzFilter;
620
621   DIALOG_AddFilterItem(&p, IDS_PROGRAMS,  "*.exe;*.pif;*.com;*.bat");
622   DIALOG_AddFilterItem(&p, IDS_ALL_FILES, "*.*");
623
624   return(DIALOG_Browse(hDlg, szzFilter, lpszFile, nMaxFile));
625 }
626
627 /***********************************************************************
628  *
629  *           DIALOG_BrowseSymbols
630  */
631
632 static BOOL DIALOG_BrowseSymbols(HWND hDlg, LPSTR lpszFile, INT nMaxFile)
633 {
634   CHAR  szzFilter[5 * MAX_STRING_LEN + 100];
635   LPSTR p = szzFilter;
636
637   DIALOG_AddFilterItem(&p, IDS_SYMBOL_FILES,  "*.ico;*.exe;*.dll");
638   DIALOG_AddFilterItem(&p, IDS_PROGRAMS,      "*.exe");
639   DIALOG_AddFilterItem(&p, IDS_LIBRARIES_DLL, "*.dll");
640   DIALOG_AddFilterItem(&p, IDS_SYMBOLS_ICO,   "*.ico");
641   DIALOG_AddFilterItem(&p, IDS_ALL_FILES,     "*.*");
642
643   return(DIALOG_Browse(hDlg, szzFilter, lpszFile, nMaxFile));
644 }
645
646 /* Local Variables:    */
647 /* c-file-style: "GNU" */
648 /* End:                */