source: trunk/dll/remap.c@ 1212

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

Ticket 187: Move data declarations/definitions out of fm3dll.h

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