Changeset 328 for trunk/dll/viewinf.c
- Timestamp:
- Jul 25, 2006, 8:37:24 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/viewinf.c
r123 r328 4 4 $Id$ 5 5 6 Launch inf viewer 7 6 8 Copyright (c) 1993-98 M. Kimes 7 Copyright (c) 2004 Steven H.Levine 8 9 Revisions 01 Aug 04 SHL - Rework lstrip/rstrip usage 9 Copyright (c) 2004, 2006 Steven H.Levine 10 11 01 Aug 04 SHL Rework lstrip/rstrip usage 12 17 Jul 06 SHL Use Runtime_Error 10 13 11 14 ***********************************************************************/ … … 15 18 #define INCL_DOS 16 19 #define INCL_WIN 17 18 20 #include <os2.h> 21 19 22 #include <stdio.h> 20 23 #include <stdlib.h> … … 22 25 #include <ctype.h> 23 26 #include <share.h> 27 24 28 #include "fm3dll.h" 25 29 #include "fm3dlg.h" … … 27 31 28 32 #pragma data_seg(DATA1) 33 34 static PSZ pszSrcFile = __FILE__; 35 29 36 #pragma alloc_text(VIEWINFS,FillListbox,ViewInfProc) 30 37 … … 36 43 37 44 38 static VOID FillListbox (VOID *args) {39 45 static VOID FillListbox (VOID *args) 46 { 40 47 HWND hwnd; 41 48 DUMMY *dummy = (DUMMY *)args; … … 70 77 } 71 78 else { 72 holdenv = malloc(strlen(env) + 2L); 73 if(!holdenv) 74 saymsg(MB_CANCEL, 75 hwnd, 76 GetPString(IDS_ERRORTEXT), 77 GetPString(IDS_OUTOFMEMORY)); 78 else { 79 holdenv = xmalloc(strlen(env) + 2L,pszSrcFile,__LINE__); 80 if (holdenv) { 79 81 strcpy(holdenv,env); 80 82 Repeat: … … 168 170 &size) && 169 171 size) { 170 holdenv = malloc(size + 2L);171 if (holdenv) {172 if (PrfQueryProfileData(fmprof,173 FM3Str,174 key,175 holdenv, 176 &size))172 holdenv = xmalloc(size + 2L,pszSrcFile,__LINE__); 173 if (holdenv) { 174 if (!PrfQueryProfileData(fmprof,FM3Str,key,holdenv,&size)) { 175 Win_Error(hwnd,hwnd,pszSrcFile,__LINE__,"PrfQueryProfileData"); 176 free(holdenv); 177 } 178 else 177 179 goto Repeat; 178 else179 free(holdenv);180 180 } 181 181 } … … 192 192 193 193 194 MRESULT EXPENTRY ViewInfProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {195 194 MRESULT EXPENTRY ViewInfProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 195 { 196 196 static HWND hwndMe = (HWND)0; 197 197 static BOOL help = FALSE; … … 213 213 } 214 214 help = (mp2 != (MPARAM)0); 215 if (help) {215 if (help) { 216 216 217 217 SWP swp; … … 282 282 DUMMY *d; 283 283 284 d = malloc(sizeof(DUMMY)); 285 if(d) { 286 memset(d,0,sizeof(DUMMY)); 284 d = xmallocz(sizeof(DUMMY),pszSrcFile,__LINE__); 285 if (!d) { 286 WinDismissDlg(hwnd,0); 287 return 0; 288 } 289 else { 287 290 d->size = sizeof(DUMMY); 288 291 d->hwnd = hwnd; 289 if (help)292 if (help) 290 293 d->help = 1; 291 294 if(_beginthread(FillListbox,NULL,65536,(PVOID)d) == -1) { 292 DosBeep(50,100);295 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 293 296 free(d); 294 297 WinDismissDlg(hwnd,0); … … 297 300 WinEnableWindow(WinWindowFromID(hwnd,DID_CANCEL),FALSE); 298 301 threaddone = FALSE; 299 }300 else {301 DosBeep(100,100);302 WinDismissDlg(hwnd,0);303 return 0;304 302 } 305 303 } … … 478 476 sSelect++; 479 477 } 480 #else 478 #else // !BUGIFIXED 481 479 for(sSelect = 0;sSelect < sTotal;sSelect++) 482 480 WinSendDlgItemMsg(hwnd, … … 524 522 sSelect++; 525 523 } 526 #endif 524 #endif // BUGFIXED 527 525 } 528 526 break; … … 532 530 CHAR szBuffer[1001],*key = "INFPaths"; 533 531 534 if (help)532 if (help) 535 533 key = "HLPPaths"; 536 534 *szBuffer = 0; … … 569 567 MPFROM2SHORT(LIT_FIRST,0), 570 568 MPVOID); 571 if(sSelect >= 0) { 572 if(help) { 569 if (sSelect < 0) { 570 DosBeep(50,100); 571 } 572 else { 573 if (help) { 573 574 *text = 0; 574 575 WinSendDlgItemMsg(hwnd, … … 578 579 MPFROMP(text)); 579 580 p = strchr(text,'>'); 580 if(!p) 581 if(!p) { 582 DosBeep(50,100); 581 583 break; 584 } 582 585 p++; 583 586 bstrip(p); 584 if(*p) 587 if (!*p) 588 DosBeep(50,100); 589 else 585 590 ViewHelp(p); 586 else587 DosBeep(250,100);588 591 break; 589 592 } … … 592 595 strcat(filename,"\\"); 593 596 strcat(filename,"FM2VINF.CMD"); 594 fp = fopen(filename,"w");595 if (fp) {597 fp = xfopen(filename,"w",pszSrcFile,__LINE__); 598 if (fp) { 596 599 fprintf(fp,"@ECHO OFF\nSET FM2REF="); 597 600 while(sSelect >= 0) { … … 619 622 MPFROM2SHORT(sSelect,0), 620 623 MPVOID); 621 } 624 } // while 622 625 *text = 0; 623 626 WinQueryDlgItemText(hwnd,
Note:
See TracChangeset
for help on using the changeset viewer.