Documentation ordinal fixes.
[wine] / dlls / commdlg / finddlg32.c
1 /*
2  *  Common Dialog Boxes interface (32 bit)
3  *  Find/Replace
4  *
5  * Copyright 1998,1999 Bertho A. Stultiens
6  */
7
8 #include <string.h>
9 #include "winbase.h"
10 #include "windef.h"
11 #include "winnls.h"
12 #include "wingdi.h"
13 #include "winuser.h"
14 #include "commdlg.h"
15 #include "cderr.h"
16 #include "dlgs.h"
17 #include "debugtools.h"
18
19 DEFAULT_DEBUG_CHANNEL(commdlg);
20
21 #include "cdlg.h"
22
23
24 /*-----------------------------------------------------------------------*/
25
26 static UINT             FindReplaceMessage;
27 static UINT             HelpMessage;
28
29 #define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM)
30 /* CRITICAL_SECTION COMDLG32_CritSect; */
31
32 /* Notes:
33  * MS uses a critical section at a few locations. However, I fail to
34  * see the reason for this. Their comdlg32.dll has a few race conditions
35  * but _not_ at those places that are protected with the mutex (there are
36  * globals that seem to hold info for the wndproc).
37  *
38  * FindText[AW]/ReplaceText[AW]
39  * The find/replace calls are passed a structure that is _not_ used
40  * internally. There is a local copy that holds the running info to
41  * be able to combine xxxA and xxxW calls. The passed pointer is
42  * returned upon sendmessage. Apps wont break this way when they rely
43  * on the original pointer. This will work as long as the sizes of
44  * FINDREPLACEA == FINDREPLACEW. The local copy will also prevent
45  * the app to see the wine-specific extra flags to distinguish between
46  * A/W and Find/Replace.
47  */
48
49
50 /***********************************************************************
51  *      COMDLG32_FR_GetFlags                    [internal]
52  * Returns the button state that needs to be reported to the caller.
53  *      RETURNS
54  *              Current state of check and radio buttons
55  */
56 static DWORD COMDLG32_FR_GetFlags(HWND hDlgWnd)
57 {
58         DWORD flags = 0;
59         if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED)
60                 flags |= FR_DOWN;
61         if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED)
62                 flags |= FR_WHOLEWORD;
63         if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED)
64                 flags |= FR_MATCHCASE;
65         return flags;
66 }
67
68 /***********************************************************************
69  *      COMDLG32_FR_HandleWMCommand             [internal]
70  * Handle WM_COMMAND messages...
71  */
72 static void COMDLG32_FR_HandleWMCommand(HWND hDlgWnd, COMDLG32_FR_Data *pData, int Id, int NotifyCode)
73 {
74         DWORD flag;
75
76         pData->user_fr.fra->Flags &= ~FR_MASK;  /* Clear return flags */
77         if(pData->fr.Flags & FR_WINE_REPLACE)   /* Replace always goes down... */
78                 pData->user_fr.fra->Flags |= FR_DOWN;
79
80         if(NotifyCode == BN_CLICKED)
81         {
82                 switch(Id)
83                 {
84                 case IDOK: /* Find Next */
85                         if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)
86                         {
87                                 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT;
88                                 if(pData->fr.Flags & FR_WINE_UNICODE)
89                                 {
90                                     MultiByteToWideChar( CP_ACP, 0, pData->fr.lpstrFindWhat, -1,
91                                                          pData->user_fr.frw->lpstrFindWhat,
92                                                          0x7fffffff );
93                                 }
94                                 else
95                                 {
96                                         strcpy(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);
97                                 }
98                                 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
99                         }
100                         break;
101
102                 case IDCANCEL:
103                         pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM;
104                         SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
105                         DestroyWindow(hDlgWnd);
106                         break;
107
108                 case psh2: /* Replace All */
109                         flag = FR_REPLACEALL;
110                         goto Replace;
111
112                 case psh1: /* Replace */
113                         flag = FR_REPLACE;
114 Replace:
115                         if((pData->fr.Flags & FR_WINE_REPLACE)
116                         && GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)
117                         {
118                                 pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */
119                                 GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen);
120                                 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag;
121                                 if(pData->fr.Flags & FR_WINE_UNICODE)
122                                 {
123                                     MultiByteToWideChar( CP_ACP, 0, pData->fr.lpstrFindWhat, -1,
124                                                          pData->user_fr.frw->lpstrFindWhat,
125                                                          0x7fffffff );
126                                     MultiByteToWideChar( CP_ACP, 0, pData->fr.lpstrReplaceWith, -1,
127                                                          pData->user_fr.frw->lpstrReplaceWith,
128                                                          0x7fffffff );
129                                 }
130                                 else
131                                 {
132                                         strcpy(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);
133                                         strcpy(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith);
134                                 }
135                                 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
136                         }
137                         break;
138
139                 case pshHelp:
140                         pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd);
141                         SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra);
142                         break;
143                 }
144         }
145         else if(NotifyCode == EN_CHANGE && Id == edt1)
146         {
147                 BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0;
148                 EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable);
149                 if(pData->fr.Flags & FR_WINE_REPLACE)
150                 {
151                         EnableWindow(GetDlgItem(hDlgWnd, psh1), enable);
152                         EnableWindow(GetDlgItem(hDlgWnd, psh2), enable);
153                 }
154         }
155 }
156
157 /***********************************************************************
158  *      COMDLG32_FindReplaceDlgProc             [internal]
159  * [Find/Replace]Text32[A/W] window procedure.
160  */
161 static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
162 {
163         COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
164         BOOL retval = TRUE;;
165
166         if(iMsg == WM_INITDIALOG)
167         {
168                 pdata = (COMDLG32_FR_Data *)lParam;
169                 if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata))
170                 {
171                         ERR("Could not Set prop; invent a gracefull exit?...\n");
172                         DestroyWindow(hDlgWnd);
173                         return FALSE;
174                 }
175                 SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0);
176                 SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat);
177                 if(pdata->fr.Flags & FR_WINE_REPLACE)
178                 {
179                         SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0);
180                         SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith);
181                 }
182
183                 if(!(pdata->fr.Flags & FR_SHOWHELP))
184                         ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE);
185                 if(pdata->fr.Flags & FR_HIDEUPDOWN)
186                 {
187                         ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE);
188                         ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE);
189                         ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE);
190                 }
191                 else if(pdata->fr.Flags & FR_NOUPDOWN)
192                 {
193                         EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE);
194                         EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE);
195                         EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE);
196                 }
197                 else
198                 {
199                         SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0);
200                         SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0);
201                 }
202
203                 if(pdata->fr.Flags & FR_HIDEMATCHCASE)
204                         ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE);
205                 else if(pdata->fr.Flags & FR_NOMATCHCASE)
206                         EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE);
207                 else
208                         SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0);
209
210                 if(pdata->fr.Flags & FR_HIDEWHOLEWORD)
211                         ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE);
212                 else if(pdata->fr.Flags & FR_NOWHOLEWORD)
213                         EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE);
214                 else
215                         SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0);
216
217                 /* We did the init here, now call the hook if requested */
218
219                 /* We do not do ShowWindow if hook exists and is FALSE  */
220                 /*   per MSDN Article Q96135                            */
221                 if((pdata->fr.Flags & FR_ENABLEHOOK)
222                      && ! pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, (LPARAM) &pdata->fr))
223                         return TRUE;
224                 ShowWindow(hDlgWnd, SW_SHOWNORMAL);
225                 UpdateWindow(hDlgWnd);
226                 return TRUE;
227         }
228
229         if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK))
230         {
231                 retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam);
232         }
233         else
234                 retval = FALSE;
235
236         if(pdata && !retval)
237         {
238                 retval = TRUE;
239                 switch(iMsg)
240                 {
241                 case WM_COMMAND:
242                         COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam));
243                         break;
244
245                 case WM_CLOSE:
246                         COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED);
247                         break;
248
249                 case WM_HELP:
250                         /* Heeeeelp! */
251                         FIXME("Got WM_HELP. Who is gonna supply it?\n");
252                         break;
253
254                 case WM_CONTEXTMENU:
255                         /* Heeeeelp! */
256                         FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n");
257                         break;
258                 /* FIXME: Handle F1 help */
259
260                 default:
261                         retval = FALSE; /* We did not handle the message */
262                 }
263         }
264
265         /* WM_DESTROY is a special case.
266          * We need to ensure that the allocated memory is freed just before
267          * the dialog is killed. We also need to remove the added prop.
268          */
269         if(iMsg == WM_DESTROY)
270         {
271                 RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
272                 HeapFree(GetProcessHeap(), 0, pdata);
273         }
274
275         return retval;
276 }
277
278 /***********************************************************************
279  *      COMDLG32_FR_CheckPartial                [internal]
280  * Check various fault conditions in the supplied parameters that
281  * cause an extended error to be reported.
282  *      RETURNS
283  *              TRUE: Success
284  *              FALSE: Failure
285  */
286 static BOOL COMDLG32_FR_CheckPartial(
287         LPFINDREPLACEA pfr,     /* [in] Find structure */
288         BOOL Replace            /* [in] True if called as replace */
289 ) {
290         if(!pfr)
291         {
292                 COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES);
293                 return FALSE;
294         }
295
296         if(pfr->lStructSize != sizeof(FINDREPLACEA))
297         {
298                 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);
299                 return FALSE;
300         }
301
302         if(!IsWindow(pfr->hwndOwner))
303         {
304                 COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE);
305                 return FALSE;
306         }
307
308         if((pfr->wFindWhatLen < 1 || !pfr->lpstrFindWhat)
309         ||(Replace && (pfr->wReplaceWithLen < 1 || !pfr->lpstrReplaceWith)))
310         {
311                 COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO);
312                 return FALSE;
313         }
314
315         if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRINGA)) == 0)
316         {
317                 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
318                 return FALSE;
319         }
320         if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRINGA)) == 0)
321         {
322                 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
323                 return FALSE;
324         }
325
326         if((pfr->Flags & FR_ENABLEHOOK) && !pfr->lpfnHook)
327         {
328                 COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK);
329                 return FALSE;
330         }
331
332         if((pfr->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE)) && !pfr->hInstance)
333         {
334                 COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE);
335                 return FALSE;
336         }
337
338         if((pfr->Flags & FR_ENABLETEMPLATE) && !pfr->lpTemplateName)
339         {
340                 COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE);
341                 return FALSE;
342         }
343
344         return TRUE;
345 }
346
347 /***********************************************************************
348  *      COMDLG32_FR_DoFindReplace               [internal]
349  * Actual load and creation of the Find/Replace dialog.
350  *      RETURNS
351  *              Window handle to created dialog:Success
352  *              NULL:Failure
353  */
354 static HWND COMDLG32_FR_DoFindReplace(
355         COMDLG32_FR_Data *pdata /* [in] Internal data structure */
356 ) {
357         HWND hdlgwnd = 0;
358         HGLOBAL loadrc;
359         DWORD error;
360         LPDLGTEMPLATEW rcs;
361
362         TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags);
363
364         if(!(pdata->fr.Flags & FR_ENABLETEMPLATEHANDLE))
365         {
366                 HMODULE hmod = COMDLG32_hInstance;
367                 HRSRC htemplate;
368                 if(pdata->fr.Flags & FR_ENABLETEMPLATE)
369                 {
370                         hmod = (HMODULE)pdata->fr.hInstance;
371                         if(pdata->fr.Flags & FR_WINE_UNICODE)
372                         {
373                                 htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA);
374                         }
375                         else
376                         {
377                                 htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA);
378                         }
379                 }
380                 else
381                 {
382                         int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD
383                                                                      : FINDDLGORD;
384                         htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA);
385                 }
386                 if(!htemplate)
387                 {
388                         error = CDERR_FINDRESFAILURE;
389                         goto cleanup;
390                 }
391
392                 loadrc = LoadResource(hmod, htemplate);
393         }
394         else
395         {
396                 loadrc = (HGLOBAL)pdata->fr.hInstance;
397         }
398
399         if(!loadrc)
400         {
401                 error = CDERR_LOADRESFAILURE;
402                 goto cleanup;
403         }
404
405         if((rcs = (LPDLGTEMPLATEW)LockResource(loadrc)) == NULL)
406         {
407                 error = CDERR_LOCKRESFAILURE;
408                 goto cleanup;
409         }
410
411         hdlgwnd = CreateDialogIndirectParamA(COMDLG32_hInstance,
412                                              rcs,
413                                              pdata->fr.hwndOwner,
414                                              (DLGPROC)COMDLG32_FindReplaceDlgProc,
415                                              (LPARAM)pdata);
416         if(!hdlgwnd)
417         {
418                 error = CDERR_DIALOGFAILURE;
419 cleanup:
420                 COMDLG32_SetCommDlgExtendedError(error);
421                 HeapFree(GetProcessHeap(), 0, pdata);
422         }
423         return hdlgwnd;
424 }
425
426 /***********************************************************************
427  *      FindTextA                               [COMDLG32.@]
428  *      RETURNS
429  *              Window handle to created dialog: Success
430  *              NULL: Failure
431  */
432 HWND WINAPI FindTextA(
433         LPFINDREPLACEA pfr      /* [in] Find/replace structure*/
434 ) {
435         COMDLG32_FR_Data *pdata;
436
437         TRACE("LPFINDREPLACE=%p\n", pfr);
438
439         if(!COMDLG32_FR_CheckPartial(pfr, FALSE))
440                 return 0;
441
442         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)
443                 return 0; /* Error has been set */
444
445         pdata->user_fr.fra = pfr;
446         pdata->fr = *pfr;
447         return COMDLG32_FR_DoFindReplace(pdata);
448 }
449
450 /***********************************************************************
451  *      ReplaceTextA                            [COMDLG32.@]
452  *      RETURNS
453  *              Window handle to created dialog: Success
454  *              NULL: Failure
455  */
456 HWND WINAPI ReplaceTextA(
457         LPFINDREPLACEA pfr      /* [in] Find/replace structure*/
458 ) {
459         COMDLG32_FR_Data *pdata;
460
461         TRACE("LPFINDREPLACE=%p\n", pfr);
462
463         if(!COMDLG32_FR_CheckPartial(pfr, TRUE))
464                 return 0;
465
466         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)
467                 return 0; /* Error has been set */
468
469         pdata->user_fr.fra = pfr;
470         pdata->fr = *pfr;
471         pdata->fr.Flags |= FR_WINE_REPLACE;
472         return COMDLG32_FR_DoFindReplace(pdata);
473 }
474
475 /***********************************************************************
476  *      FindTextW                               [COMDLG32.@]
477  *      RETURNS
478  *              Window handle to created dialog: Success
479  *              NULL: Failure
480  */
481 HWND WINAPI FindTextW(
482         LPFINDREPLACEW pfr      /* [in] Find/replace structure*/
483 ) {
484         COMDLG32_FR_Data *pdata;
485         DWORD len;
486
487         TRACE("LPFINDREPLACE=%p\n", pfr);
488
489         if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))
490                 return 0;
491
492         len = WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen,
493                                    NULL, 0, NULL, NULL );
494         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data) + len)) == NULL)
495             return 0; /* Error has been set */
496
497         pdata->user_fr.frw = pfr;
498         pdata->fr = *(LPFINDREPLACEA)pfr;       /* FINDREPLACEx have same size */
499         pdata->fr.Flags |= FR_WINE_UNICODE;
500         pdata->fr.lpstrFindWhat = (LPSTR)(pdata + 1);  /* Set string pointer */
501         WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen,
502                              pdata->fr.lpstrFindWhat, len, NULL, NULL );
503         return COMDLG32_FR_DoFindReplace(pdata);
504 }
505
506 /***********************************************************************
507  *      ReplaceTextW                            [COMDLG32.@]
508  *      RETURNS
509  *              Window handle to created dialog: Success
510  *              NULL: Failure
511  */
512 HWND WINAPI ReplaceTextW(
513         LPFINDREPLACEW pfr      /* [in] Find/replace structure*/
514 ) {
515         COMDLG32_FR_Data *pdata;
516         DWORD len1, len2;
517
518         TRACE("LPFINDREPLACE=%p\n", pfr);
519
520         if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))
521                 return 0;
522
523         len1 = WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen,
524                                     NULL, 0, NULL, NULL );
525         len2 = WideCharToMultiByte( CP_ACP, 0, pfr->lpstrReplaceWith, pfr->wReplaceWithLen,
526                                     NULL, 0, NULL, NULL );
527         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)
528                                                           + len1 + len2)) == NULL)
529             return 0; /* Error has been set */
530
531         pdata->user_fr.frw = pfr;
532         pdata->fr = *(LPFINDREPLACEA)pfr;       /* FINDREPLACEx have same size */
533         pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE;
534         pdata->fr.lpstrFindWhat = (LPSTR)(pdata + 1);  /* Set string pointer */
535         pdata->fr.lpstrReplaceWith = pdata->fr.lpstrFindWhat + len1;
536
537         WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen,
538                              pdata->fr.lpstrFindWhat, len1, NULL, NULL );
539         WideCharToMultiByte( CP_ACP, 0, pfr->lpstrReplaceWith, pfr->wReplaceWithLen,
540                              pdata->fr.lpstrReplaceWith, len2, NULL, NULL );
541         return COMDLG32_FR_DoFindReplace(pdata);
542 }
543
544