source: trunk/dll/remap.c@ 1200

Last change on this file since 1200 was 1187, checked in by John Small, 17 years ago

Ticket 187: Draft 2: Move remaining function declarations

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.3 KB
Line 
1
2/***********************************************************************
3
4 $Id: remap.c 1187 2008-09-10 21:58:04Z jbs $
5
6 Copyright (c) 1993, 1998 M. Kimes
7 Copyright (c) 2004, 2008 Steven H.Levine
8
9 01 Aug 04 SHL Rework lstrip/rstrip usage
10 06 Aug 05 SHL Renames
11 22 Jul 06 SHL Check more run time errors
12 29 Jul 06 SHL Use xfgets
13 31 Aug 06 SHL Use _fsopen to avoid noise complaints
14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
15 29 Feb 08 GKY Use xfree where appropriate
16 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory and use BldFullPathName
17 24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file
18
19***********************************************************************/
20
21#include <stdlib.h>
22#include <string.h>
23#include <share.h>
24#include <io.h> // unlink
25
26#define INCL_DOS
27#define INCL_WIN
28#define INCL_LONGLONG // dircnrs.h
29
30#include "fm3dll.h"
31#include "fm3dlg.h"
32#include "fm3str.h"
33#include "errutil.h" // Dos_Error...
34#include "strutil.h" // GetPString
35#include "pathutil.h" // BldFullPathName
36#include "valid.h" // CheckDrive, FillInDriveFlags
37#include "remap.h"
38#include "wrappers.h" // xfgets
39#include "strips.h" // bstrip
40#include "misc.h" // CheckDriveSpaceAvail
41#include "systemf.h" // runemf2
42#include "dirs.h" // save_dir2
43#include "fortify.h"
44
45#pragma data_seg(DATA1)
46
47static PSZ pszSrcFile = __FILE__;
48
49typedef struct APPNOTIFY
50{
51 HAPP happ;
52 BOOL attach;
53 BOOL failedonce;
54 CHAR uncname[CCHMAXPATH];
55 CHAR device;
56 struct APPNOTIFY *next;
57 struct APPNOTIFY *prev;
58}
59APPNOTIFY;
60
61typedef struct LINKRES
62{
63 CHAR *res;
64 struct LINKRES *next;
65}
66LINKRES;
67
68static LINKRES *reshead = NULL;
69static BOOL loadedres = FALSE;
70
71#define MAXNUMRES 200
72
73VOID load_resources(VOID)
74{
75 /* load linked list of resources from RESOURCE.DAT file */
76
77 FILE *fp;
78 LINKRES *info, *last = NULL;
79 CHAR s[CCHMAXPATH + 14];
80 INT x = 0;
81
82 loadedres = TRUE;
83 BldFullPathName(s, pFM2SaveDirectory, "RESOURCE.DAT");
84 fp = _fsopen(s, "r", SH_DENYWR);
85 if (fp) {
86 while (x < MAXNUMRES && !feof(fp)) {
87 if (!xfgets_bstripcr(s, sizeof(s), fp, pszSrcFile, __LINE__))
88 break;
89 if (*s && *s != ';') {
90 info = xmalloc(sizeof(LINKRES), pszSrcFile, __LINE__);
91 if (info) {
92 info->res = xstrdup(s, pszSrcFile, __LINE__);
93 if (!info->res)
94 free(info);
95 else {
96 x++;
97 info->next = NULL;
98 if (!reshead)
99 reshead = info;
100 else
101 last->next = info;
102 last = info;
103 }
104 }
105 }
106 }
107 fclose(fp);
108 }
109}
110
111VOID save_resources(VOID)
112{
113 /* save linked list of resources to RESOURCE.DAT file */
114
115 LINKRES *info;
116 FILE *fp;
117 CHAR s[CCHMAXPATH + 14];
118
119 if (!loadedres)
120 return;
121 BldFullPathName(s, pFM2SaveDirectory, "RESOURCE.DAT");
122 if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2)
123 return; //already gave error msg
124 if (reshead) {
125 fp = xfopen(s, "w", pszSrcFile, __LINE__);
126 if (fp) {
127 fputs(GetPString(IDS_REMOTEFILETEXT), fp);
128 info = reshead;
129 while (info) {
130 fprintf(fp, "%0.*s\n", CCHMAXPATH, info->res);
131 info = info->next;
132 }
133 fclose(fp);
134 }
135 }
136 else
137 unlink(s);
138}
139
140BOOL add_resource(CHAR * res)
141{
142 LINKRES *info, *last = NULL;
143 INT x = 0;
144
145 if (!res || !*res)
146 return FALSE;
147 if (!loadedres)
148 load_resources();
149 info = reshead;
150 while (info) {
151 if (!stricmp(info->res, res))
152 return FALSE;
153 last = info;
154 info = info->next;
155 x++;
156 }
157 info = xmalloc(sizeof(LINKRES), pszSrcFile, __LINE__);
158 if (info) {
159 info->res = xstrdup(res, pszSrcFile, __LINE__);
160 if (!info->res)
161 free(info);
162 else {
163 info->next = NULL;
164 if (!reshead)
165 reshead = info;
166 else
167 last->next = info;
168 if (x > MAXNUMRES) {
169 info = reshead;
170 reshead = reshead->next;
171 free(info);
172 }
173 return TRUE;
174 }
175 }
176 return FALSE;
177}
178
179BOOL remove_resource(CHAR * res)
180{
181 LINKRES *info, *last = NULL;
182
183 if (!res || !*res)
184 return FALSE;
185 if (!loadedres)
186 load_resources();
187 info = reshead;
188 while (info) {
189 if (!stricmp(info->res, res)) {
190 if (last)
191 last->next = info->next;
192 else
193 reshead = info->next;
194 xfree(info->res, pszSrcFile, __LINE__);
195 free(info);
196 return TRUE;
197 }
198 last = info;
199 info = info->next;
200 }
201 return FALSE;
202}
203
204VOID free_resources(VOID)
205{
206 LINKRES *info, *next;
207
208 info = reshead;
209 while (info) {
210 next = info->next;
211 xfree(info->res, pszSrcFile, __LINE__);
212 free(info);
213 info = next;
214 }
215 reshead = NULL;
216 DosPostEventSem(CompactSem);
217}
218
219MRESULT EXPENTRY RemapDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
220{
221 static BOOL fRemapped;
222 static APPNOTIFY *apphead = NULL, *apptail = NULL;
223
224 switch (msg) {
225 case WM_INITDLG:
226 WinSendDlgItemMsg(hwnd,
227 MAP_ATTACHTO,
228 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
229 fRemapped = FALSE;
230 if (!loadedres)
231 load_resources();
232 {
233 LINKRES *info;
234
235 info = reshead;
236 while (info) {
237 WinSendDlgItemMsg(hwnd,
238 MAP_ATTACHTO,
239 LM_INSERTITEM,
240 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->res));
241 info = info->next;
242 }
243 }
244 {
245 ULONG ulDriveMap, ulDriveNum, x, ulType;
246 CHAR s[3] = " :";
247
248 DosError(FERR_DISABLEHARDERR);
249 if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) {
250 for (x = 0; x < 26; x++) {
251 if (!(driveflags[x] & DRIVE_IGNORE)) {
252 *s = (CHAR) x + 'A';
253 if (!(ulDriveMap & (1 << x)))
254 WinSendDlgItemMsg(hwnd,
255 MAP_ATTACHLIST,
256 LM_INSERTITEM,
257 MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
258 else {
259 CheckDrive((CHAR) x + 'A', NULL, &ulType);
260 if (ulType & DRIVE_REMOTE)
261 WinSendDlgItemMsg(hwnd,
262 MAP_DETACHLIST,
263 LM_INSERTITEM,
264 MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
265 }
266 }
267 }
268 }
269 else
270 WinDismissDlg(hwnd, 0);
271 }
272 break;
273
274 case WM_CONTROL:
275 switch (SHORT1FROMMP(mp1)) {
276 case MAP_ATTACHLIST:
277 switch (SHORT2FROMMP(mp1)) {
278 case LN_ENTER:
279 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MAP_ATTACH, 0), MPVOID);
280 break;
281 }
282 break;
283 case MAP_DETACHLIST:
284 switch (SHORT2FROMMP(mp1)) {
285 case LN_ENTER:
286 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MAP_DETACH, 0), MPVOID);
287 break;
288 case LN_SELECT:
289 {
290 SHORT x;
291 CHAR d[3];
292
293 WinSetDlgItemText(hwnd, MAP_ATTACHTO, NullStr);
294 x = (SHORT) WinSendDlgItemMsg(hwnd,
295 MAP_DETACHLIST,
296 LM_QUERYSELECTION,
297 MPFROMSHORT(LIT_FIRST), MPVOID);
298 if (x >= 0) {
299 *d = 0;
300 WinSendDlgItemMsg(hwnd,
301 MAP_DETACHLIST,
302 LM_QUERYITEMTEXT,
303 MPFROM2SHORT(x, sizeof(d)), MPFROMP(d));
304 if (*d) {
305
306 CHAR buf[2048];
307 ULONG len;
308 APIRET rc;
309 FSQBUFFER2 *p2;
310
311 memset(buf, 0, sizeof(buf));
312 len = sizeof(buf);
313 p2 = (FSQBUFFER2 *) buf;
314 DosError(FERR_DISABLEHARDERR);
315 rc = DosQueryFSAttach(d, 0, FSAIL_QUERYNAME, p2, &len);
316 if (!rc) {
317
318 CHAR *p;
319
320 p = (char *)p2->szName;
321 p += p2->cbName + 1;
322 p += p2->cbFSDName + 1;
323 if (p2->cbFSAData)
324 WinSetDlgItemText(hwnd, MAP_ATTACHTO, p);
325 else
326 WinSetDlgItemText(hwnd,
327 MAP_ATTACHTO,
328 GetPString(IDS_UNKNOWNBRKTTEXT));
329 }
330 else
331 WinSetDlgItemText(hwnd,
332 MAP_ATTACHTO,
333 GetPString(IDS_UNKNOWNBRKTTEXT));
334 }
335 }
336 }
337 break;
338 }
339 break;
340 }
341 break;
342
343 case WM_APPTERMINATENOTIFY:
344 {
345 APPNOTIFY *info;
346 SHORT x, c;
347 CHAR d[3];
348 HWND hwndList;
349
350 if (!mp2)
351 fRemapped = TRUE;
352 info = apphead;
353 GetRidOfIt:
354 while (info) {
355 if (info->happ == (HAPP) mp1) {
356/* Note: if this next line is removed, FM/2 will start the attach/detach
357 * request again, once for each request, to see if it might succeed and to
358 * ensure the request is seen by the user in case interaction is required.
359 */
360 info->failedonce = TRUE;
361 hwndList = WinWindowFromID(hwnd,
362 (info->attach) ?
363 MAP_ATTACHLIST : MAP_DETACHLIST);
364 if (!mp2 || (ULONG) mp2 == 1041 || info->failedonce) {
365 if (info->prev)
366 info->prev->next = info->next;
367 if (info->next)
368 info->next->prev = info->prev;
369 if (apphead == info)
370 apphead = info->next;
371 if (apptail == info)
372 apptail = info->prev;
373 }
374 if (!mp2) {
375 if (*info->uncname &&
376 stricmp(info->uncname, GetPString(IDS_UNKNOWNBRKTTEXT)) &&
377 add_resource(info->uncname)) {
378 save_resources();
379 WinSendDlgItemMsg(hwnd,
380 MAP_ATTACHTO,
381 LM_INSERTITEM,
382 MPFROM2SHORT(LIT_END, 0),
383 MPFROMP(info->uncname));
384 }
385 c = (SHORT) WinSendMsg(hwndList,
386 LM_QUERYITEMCOUNT, MPVOID, MPVOID);
387 if (c > 0) {
388 for (x = 0; x < c; x++) {
389 *d = 0;
390 WinSendMsg(hwndList,
391 LM_QUERYITEMTEXT,
392 MPFROM2SHORT(x, sizeof(d)), MPFROMP(d));
393 if (*d == info->device) {
394 WinSendMsg(hwndList, LM_DELETEITEM, MPFROMSHORT(x), MPVOID);
395 hwndList = WinWindowFromID(hwnd,
396 (info->attach) ?
397 MAP_DETACHLIST : MAP_ATTACHLIST);
398 d[1] = ':';
399 d[2] = 0;
400 WinSendMsg(hwndList,
401 LM_INSERTITEM,
402 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(d));
403 break;
404 }
405 }
406 }
407 }
408 else if ((ULONG) mp2 != 1041 && !info->failedonce) {
409
410 PROGDETAILS pgd;
411 CHAR params[368], *p;
412 HAPP happ;
413
414 *d = info->device;
415 d[1] = ':';
416 d[2] = 0;
417 p = GetCmdSpec(FALSE);
418 memset(&pgd, 0, sizeof(pgd));
419 pgd.Length = sizeof(pgd);
420 pgd.progt.progc = PROG_WINDOWABLEVIO;
421 pgd.progt.fbVisible = SHE_VISIBLE;
422 pgd.pszTitle = (info->attach) ? GetPString(IDS_ATTACHREQTEXT) :
423 GetPString(IDS_DETACHREQTEXT);
424 pgd.pszExecutable = p;
425 pgd.pszParameters = params;
426 pgd.pszStartupDir = NULL;
427 pgd.pszIcon = NULL;
428 pgd.pszEnvironment = NULL;
429 pgd.swpInitial.hwndInsertBehind = HWND_TOP;
430 pgd.swpInitial.hwnd = hwnd;
431 pgd.swpInitial.fl = SWP_SHOW | SWP_ACTIVATE;
432 if (info->attach)
433 sprintf(params, "/C NET USE %s \"%s\"", d, info->uncname);
434 else
435 sprintf(params, "/C NET USE %s /D", d);
436 info->failedonce = TRUE;
437 happ = WinStartApp(hwnd, &pgd, pgd.pszParameters,
438 NULL, SAF_MAXIMIZED);
439 if (!happ)
440 goto GetRidOfIt;
441 info->happ = happ;
442 break;
443 }
444 else if ((ULONG) mp2 == 1041)
445 saymsg(MB_CANCEL | MB_ICONEXCLAMATION, hwnd,
446 GetPString(IDS_ERRORTEXT),
447 "%s", GetPString(IDS_CANTSTARTNETUSETEXT));
448 if (!mp2 || (ULONG) mp2 == 1041 || info->failedonce)
449 free(info);
450 break;
451 }
452 info = info->next;
453 }
454 }
455 break;
456
457 case WM_COMMAND:
458 switch (SHORT1FROMMP(mp1)) {
459 case MAP_DELETE:
460 {
461 SHORT x;
462 CHAR resource[CCHMAXPATH];
463
464 x = (SHORT) WinSendDlgItemMsg(hwnd,
465 MAP_ATTACHTO,
466 LM_QUERYSELECTION,
467 MPFROMSHORT(LIT_FIRST), MPVOID);
468 if (x >= 0) {
469 *resource = 0;
470 WinSendDlgItemMsg(hwnd,
471 MAP_ATTACHTO,
472 LM_QUERYITEMTEXT,
473 MPFROM2SHORT(x, sizeof(resource)),
474 MPFROMP(resource));
475 bstrip(resource);
476 if (*resource) {
477 if (remove_resource(resource)) {
478 save_resources();
479 WinSendDlgItemMsg(hwnd,
480 MAP_ATTACHTO,
481 LM_DELETEITEM, MPFROMSHORT(x), MPVOID);
482 if (x)
483 x--;
484 WinSendDlgItemMsg(hwnd,
485 MAP_ATTACHTO,
486 LM_SELECTITEM,
487 MPFROMSHORT(x), MPFROMSHORT(TRUE));
488 if (!(SHORT) WinSendDlgItemMsg(hwnd,
489 MAP_ATTACHTO,
490 LM_QUERYITEMCOUNT,
491 MPVOID, MPVOID))
492 WinSetDlgItemText(hwnd, MAP_ATTACHTO, NullStr);
493 }
494 }
495 }
496 }
497 break;
498
499 case MAP_CLEAR:
500 free_resources();
501 save_resources();
502 WinSendDlgItemMsg(hwnd, MAP_ATTACHTO, LM_DELETEALL, MPVOID, MPVOID);
503 WinSetDlgItemText(hwnd, MAP_ATTACHTO, NullStr);
504 break;
505
506 case MAP_INFO:
507 case MAP_DETACH:
508 {
509 CHAR d[3], s[CCHMAXPATH];
510 SHORT x;
511
512 *s = 0;
513 WinQueryDlgItemText(hwnd, MAP_ATTACHTO, sizeof(s), s);
514 bstrip(s);
515 x = (SHORT) WinSendDlgItemMsg(hwnd,
516 MAP_DETACHLIST,
517 LM_QUERYSELECTION,
518 MPFROMSHORT(LIT_FIRST), MPVOID);
519 if (x >= 0) {
520 *d = 0;
521 WinSendDlgItemMsg(hwnd,
522 MAP_DETACHLIST,
523 LM_QUERYITEMTEXT,
524 MPFROM2SHORT(x, sizeof(d)), MPFROMP(d));
525 if (*d) {
526 switch (SHORT1FROMMP(mp1)) {
527 case MAP_DETACH:
528 {
529 PROGDETAILS pgd;
530 CHAR params[368], *p;
531 HAPP happ;
532
533 p = GetCmdSpec(FALSE);
534 memset(&pgd, 0, sizeof(pgd));
535 pgd.Length = sizeof(pgd);
536 pgd.progt.progc = PROG_WINDOWABLEVIO;
537 pgd.progt.fbVisible = SHE_VISIBLE;
538 pgd.pszTitle = GetPString(IDS_DETACHREQTEXT);
539 pgd.pszExecutable = p;
540 pgd.pszParameters = params;
541 pgd.pszStartupDir = NULL;
542 pgd.pszIcon = NULL;
543 pgd.pszEnvironment = NULL;
544 pgd.swpInitial.hwndInsertBehind = HWND_TOP;
545 pgd.swpInitial.hwnd = hwnd;
546 pgd.swpInitial.fl = SWP_SHOW | SWP_ACTIVATE;
547 sprintf(params, "/C NET USE %s /D", d);
548 happ = WinStartApp(hwnd,
549 &pgd,
550 pgd.pszParameters, NULL, SAF_MAXIMIZED);
551 if (happ) {
552
553 APPNOTIFY *info;
554
555 WinSetDlgItemText(hwnd, MAP_ATTACHTO, NullStr);
556 info = xmallocz(sizeof(APPNOTIFY), pszSrcFile, __LINE__);
557 if (info) {
558 info->happ = happ;
559 info->attach = FALSE;
560 info->failedonce = FALSE;
561 strcpy(info->uncname, s);
562 info->device = *d;
563 if (!apphead)
564 apphead = info;
565 else {
566 apptail->next = info;
567 info->prev = apptail;
568 }
569 apptail = info;
570 }
571 }
572 else
573 saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
574 hwnd,
575 GetPString(IDS_ERRORTEXT),
576 GetPString(IDS_CANTSTARTTEXT), p, params);
577 }
578#ifdef NEVER // fixme to be gone?
579 DosError(FERR_DISABLEHARDERR);
580 rc = DosFSAttach(d, s, d, strlen(d) + 1, FS_DETACH);
581 if (rc) {
582 Dos_Error(MB_CANCEL,
583 rc,
584 hwnd,
585 pszSrcFile,
586 __LINE__, GetPString(IDS_DETACHFAILEDTEXT), d, s);
587 }
588 else {
589 fRemapped = TRUE;
590 WinSendDlgItemMsg(hwnd,
591 MAP_DETACHLIST,
592 LM_DELETEITEM, MPFROMSHORT(x), MPVOID);
593 WinSendDlgItemMsg(hwnd,
594 MAP_ATTACHLIST,
595 LM_INSERTITEM,
596 MPFROM2SHORT(LIT_SORTASCENDING, 0),
597 MPFROMP(d));
598 }
599#endif // fixme to be gone?
600 break;
601
602 case MAP_INFO:
603 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
604 hwnd, pszSrcFile, __LINE__,
605 NULL, NULL, "%s /C NET USE %s", GetCmdSpec(FALSE), d);
606 break;
607 }
608 }
609 }
610 }
611 break;
612
613 case MAP_ATTACH:
614 {
615 CHAR d[3], s[CCHMAXPATH];
616 SHORT x;
617
618 *s = 0;
619 WinQueryDlgItemText(hwnd, MAP_ATTACHTO, sizeof(s), s);
620 bstrip(s);
621 if (*s) {
622 x = (SHORT) WinSendDlgItemMsg(hwnd,
623 MAP_ATTACHLIST,
624 LM_QUERYSELECTION,
625 MPFROMSHORT(LIT_FIRST), MPVOID);
626 if (x >= 0) {
627 *d = 0;
628 WinSendDlgItemMsg(hwnd,
629 MAP_ATTACHLIST,
630 LM_QUERYITEMTEXT,
631 MPFROM2SHORT(x, sizeof(d)), MPFROMP(d));
632 if (*d) {
633
634 PROGDETAILS pgd;
635 CHAR params[368], *p;
636 HAPP happ;
637
638 p = GetCmdSpec(FALSE);
639 memset(&pgd, 0, sizeof(pgd));
640 pgd.Length = sizeof(pgd);
641 pgd.progt.progc = PROG_WINDOWABLEVIO;
642 pgd.progt.fbVisible = SHE_VISIBLE;
643 pgd.pszTitle = GetPString(IDS_ATTACHREQTEXT);
644 pgd.pszExecutable = p;
645 pgd.pszParameters = params;
646 pgd.pszStartupDir = NULL;
647 pgd.pszIcon = NULL;
648 pgd.pszEnvironment = NULL;
649 pgd.swpInitial.hwndInsertBehind = HWND_TOP;
650 pgd.swpInitial.hwnd = hwnd;
651 pgd.swpInitial.fl = SWP_SHOW | SWP_ACTIVATE;
652 sprintf(params, "/C NET USE %s \"%s\"", d, s);
653 happ = WinStartApp(hwnd,
654 &pgd,
655 pgd.pszParameters, NULL, SAF_MAXIMIZED);
656 if (happ) {
657
658 APPNOTIFY *info;
659
660 info = xmallocz(sizeof(APPNOTIFY), pszSrcFile, __LINE__);
661 if (info) {
662 info->happ = happ;
663 info->attach = TRUE;
664 info->failedonce = FALSE;
665 strcpy(info->uncname, s);
666 info->device = *d;
667 if (!apphead)
668 apphead = info;
669 else {
670 apptail->next = info;
671 info->prev = apptail;
672 }
673 apptail = info;
674 }
675 }
676 else
677 saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
678 hwnd,
679 GetPString(IDS_ERRORTEXT),
680 GetPString(IDS_CANTSTARTTEXT), p, params);
681#ifdef NEVER // fixme to be gone?
682 DosError(FERR_DISABLEHARDERR);
683 rc = DosFSAttach(d, s, s, strlen(s) + 1, FS_ATTACH);
684 if (rc) {
685 Dos_Error(MB_CANCEL,
686 rc,
687 hwnd,
688 pszSrcFile,
689 __LINE__, GetPString(IDS_ATTACHFAILEDTEXT), s, d);
690 }
691 else {
692 fRemapped = TRUE;
693 WinSendDlgItemMsg(hwnd,
694 MAP_ATTACHLIST,
695 LM_DELETEITEM, MPFROMSHORT(x), MPVOID);
696 WinSendDlgItemMsg(hwnd,
697 MAP_DETACHLIST,
698 LM_INSERTITEM,
699 MPFROM2SHORT(LIT_SORTASCENDING, 0),
700 MPFROMP(d));
701 }
702#endif // fixme to be gone?
703 }
704 }
705 }
706 }
707 break;
708
709 case IDM_HELP:
710 if (hwndHelp)
711 WinSendMsg(hwndHelp,
712 HM_DISPLAY_HELP,
713 MPFROM2SHORT(HELP_REMAP, 0), MPFROMSHORT(HM_RESOURCEID));
714 break;
715
716 case DID_CANCEL:
717 if (fRemapped) {
718 if (hwndTree)
719 PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
720 else
721 FillInDriveFlags(NULL);
722 if (hwndMain)
723 PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
724 }
725 WinDismissDlg(hwnd, 0);
726 break;
727 }
728 return 0;
729
730 case WM_DESTROY:
731 if (apphead) {
732
733 APPNOTIFY *info, *next;
734
735 info = apphead;
736 while (info) {
737 next = info->next;
738 free(info);
739 info = next;
740 }
741 apphead = apptail = NULL;
742 saymsg(MB_YESNOCANCEL,
743 HWND_DESKTOP,
744 GetPString(IDS_NOTICETITLETEXT),
745 "%s", GetPString(IDS_REMAPNOTICETEXT));
746 }
747 free_resources();
748 loadedres = FALSE;
749 break;
750 }
751 return WinDefDlgProc(hwnd, msg, mp1, mp2);
752}
753
754#pragma alloc_text(FMREMAP,RemapDlgProc,load_resources,save_resources)
755#pragma alloc_text(FMREMAP,add_resource,remove_resource,free_resources)
Note: See TracBrowser for help on using the repository browser.