source: trunk/dll/remap.c@ 766

Last change on this file since 766 was 766, checked in by Gregg Young, 18 years ago

format cleanup

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