Changeset 353
- Timestamp:
- Jul 26, 2006, 9:39:09 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/dll/remap.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/remap.c
r246 r353 5 5 6 6 Copyright (c) 1993, 1998 M. Kimes 7 Copyright (c) 2004, 200 5Steven H.Levine7 Copyright (c) 2004, 2006 Steven H.Levine 8 8 9 9 01 Aug 04 SHL Rework lstrip/rstrip usage 10 10 06 Aug 05 SHL Renames 11 22 Jul 06 SHL Check more run time errors 11 12 12 13 ***********************************************************************/ … … 27 28 28 29 #pragma data_seg(DATA1) 30 31 static PSZ pszSrcFile = __FILE__; 32 29 33 #pragma alloc_text(FMREMAP,RemapDlgProc,load_resources,save_resources) 30 34 #pragma alloc_text(FMREMAP,add_resource,remove_resource,free_resources) … … 51 55 52 56 53 VOID load_resources (VOID) {54 57 VOID load_resources (VOID) 58 { 55 59 /* load linked list of resources from RESOURCE.DAT file */ 56 60 … … 65 69 strcat(s,"\\"); 66 70 strcat(s,"RESOURCE.DAT"); 67 fp = _fsopen(s,"r",SH_DENYWR);68 if (fp) {71 fp = xfsopen(s,"r",SH_DENYWR,pszSrcFile,__LINE__); 72 if (fp) { 69 73 while(x < MAXNUMRES && !feof(fp)) { 70 74 if(!fgets(s,sizeof(s),fp)) … … 73 77 bstripcr(s); 74 78 if(*s && *s != ';') { 75 info = malloc(sizeof(LINKRES)); 76 if(info) { 77 info->res = strdup(s); 78 if(info->res) { 79 info = xmalloc(sizeof(LINKRES),pszSrcFile,__LINE__); 80 if (info) { 81 info->res = xstrdup(s,pszSrcFile,__LINE__); 82 if (!info->res) 83 free(info); 84 else { 79 85 x++; 80 86 info->next = NULL; … … 85 91 last = info; 86 92 } 87 else88 free(info);89 93 } 90 94 } … … 95 99 96 100 97 VOID save_resources (VOID) {98 101 VOID save_resources (VOID) 102 { 99 103 /* save linked list of resources to RESOURCE.DAT file */ 100 104 … … 110 114 strcat(s,"RESOURCE.DAT"); 111 115 if(reshead) { 112 fp = fopen(s,"w");113 if (fp) {116 fp = xfopen(s,"w",pszSrcFile,__LINE__); 117 if (fp) { 114 118 fputs(GetPString(IDS_REMOTEFILETEXT),fp); 115 119 info = reshead; 116 while (info) {120 while (info) { 117 121 fprintf(fp, 118 122 "%0.*s\n", … … 129 133 130 134 131 BOOL add_resource (CHAR *res) {132 135 BOOL add_resource (CHAR *res) 136 { 133 137 LINKRES *info,*last = NULL; 134 138 INT x = 0; … … 146 150 x++; 147 151 } 148 info = malloc(sizeof(LINKRES));152 info = xmalloc(sizeof(LINKRES),pszSrcFile,__LINE__); 149 153 if(info) { 150 info->res = strdup(res); 151 if(info->res) { 154 info->res = xstrdup(res,pszSrcFile,__LINE__); 155 if (!info->res) 156 free(info); 157 else { 152 158 info->next = NULL; 153 159 if(!reshead) … … 162 168 return TRUE; 163 169 } 164 else165 free(info);166 170 } 167 171 return FALSE; … … 169 173 170 174 171 BOOL remove_resource (CHAR *res) {172 175 BOOL remove_resource (CHAR *res) 176 { 173 177 LINKRES *info,*last = NULL; 174 178 … … 195 199 196 200 197 VOID free_resources (VOID) {198 201 VOID free_resources (VOID) 202 { 199 203 LINKRES *info,*next; 200 204 … … 211 215 212 216 213 MRESULT EXPENTRY RemapDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {214 217 MRESULT EXPENTRY RemapDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 218 { 215 219 static BOOL fRemapped; 216 220 static APPNOTIFY *apphead = NULL,*apptail = NULL; … … 601 605 MAP_ATTACHTO, 602 606 NullStr); 603 info = malloc(sizeof(APPNOTIFY)); 604 if(info) { 605 memset(info,0,sizeof(APPNOTIFY)); 607 info = xmallocz(sizeof(APPNOTIFY),pszSrcFile,__LINE__); 608 if (info) { 606 609 info->happ = happ; 607 610 info->attach = FALSE; … … 626 629 params); 627 630 } 628 #ifdef NEVER 631 #ifdef NEVER // fixme to be gone? 629 632 DosError(FERR_DISABLEHARDERR); 630 633 rc = DosFSAttach(d, … … 633 636 strlen(d) + 1, 634 637 FS_DETACH); 635 if(!rc) { 638 if (rc) { 639 Dos_Error(MB_CANCEL, 640 rc, 641 hwnd, 642 pszSrcFile, 643 __LINE__, 644 GetPString(IDS_DETACHFAILEDTEXT), 645 d, 646 s); 647 } 648 else { 636 649 fRemapped = TRUE; 637 650 WinSendDlgItemMsg(hwnd, … … 646 659 MPFROMP(d)); 647 660 } 648 else 649 Dos_Error(MB_CANCEL, 650 rc, 651 hwnd, 652 __FILE__, 653 __LINE__, 654 GetPString(IDS_DETACHFAILEDTEXT), 655 d, 656 s); 657 #endif 661 #endif // fixme to be gone? 658 662 break; 659 663 … … 727 731 APPNOTIFY *info; 728 732 729 info = malloc(sizeof(APPNOTIFY)); 730 if(info) { 731 memset(info,0,sizeof(APPNOTIFY)); 733 info = xmallocz(sizeof(APPNOTIFY),pszSrcFile,__LINE__); 734 if (info) { 732 735 info->happ = happ; 733 736 info->attach = TRUE; … … 751 754 p, 752 755 params); 753 #ifdef NEVER 756 #ifdef NEVER // fixme to be gone? 754 757 DosError(FERR_DISABLEHARDERR); 755 758 rc = DosFSAttach(d,s,s,strlen(s) + 1,FS_ATTACH); 756 if(!rc) { 759 if (rc) { 760 Dos_Error(MB_CANCEL, 761 rc, 762 hwnd, 763 pszSrcFile, 764 __LINE__, 765 GetPString(IDS_ATTACHFAILEDTEXT), 766 s, 767 d); 768 } 769 else { 757 770 fRemapped = TRUE; 758 771 WinSendDlgItemMsg(hwnd, … … 767 780 MPFROMP(d)); 768 781 } 769 else 770 Dos_Error(MB_CANCEL, 771 rc, 772 hwnd, 773 __FILE__, 774 __LINE__, 775 GetPString(IDS_ATTACHFAILEDTEXT), 776 s, 777 d); 778 #endif 782 #endif // fixme to be gone? 779 783 } 780 784 }
Note:
See TracChangeset
for help on using the changeset viewer.
