home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4155 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  98 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: in2.uu.net!utcsri!utgpu!utinfo!news
  3. From: normb@gpu.utcc.utoronto.ca
  4. Subject: Working with LoadSeg()
  5. X-Nntp-Posting-Host: control3.utcc.utoronto.ca
  6. Content-Type: text/plain; charset=us-ascii
  7. Message-ID: <DMs687.9w2@utcc.utoronto.ca>
  8. Sender: news@utcc.utoronto.ca (News)
  9. Content-Transfer-Encoding: 7bit
  10. Organization: UTCC Campus Access
  11. Mime-Version: 1.0
  12. Date: Wed, 14 Feb 1996 19:31:18 GMT
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15.  
  16. I'm still looking for a little light to be shed on
  17. working with loadseg()
  18.  
  19. This section of code is from Ben Hutchings (thanks Ben)...
  20.  
  21. > if( libseg = LoadSeg(libname) ) /* use _full_ pathname */
  22. > {
  23. >    /* get pointer to embedded Resident structure */
  24. >    libres = (struct Resident *)((LONG *)BADDR(libseg)+2);
  25.      ^^^^^^
  26.      This allways seems to work.
  27. >
  28. >    /* check that it really is a library */
  29. >    if( ((ULONG *)libres)[-1] != 0x70ff4e75 ||
  30.                                   ^^^^^^^^^^
  31.      This doesnt Allways work. Some valid libraries have this value.
  32.      Any reason why I cant use the rt_Type Field and look for NT_LIBRARY??
  33.  
  34. >    libres->rt_MatchWord != RT_MATCHWORD ||
  35.                              ^^^^^^^^^^^^
  36.                       I guess you mean RTC_MATCHWORD
  37.  
  38. >    libres->rt_MatchPtr != (APTR)libres )
  39. >     /* rt_MatchPtr is wrong - I forget the real name */
  40.          I think this is rt_MatchTag and I've found that in most
  41.          cases, if these  pointers arent the same then I get bad data.
  42.  
  43. >               {
  44. >                       /* copy fields */
  45. >               }
  46. >               else
  47. >                       /* not a library */
  48. >               UnLoadSeg(libseg);
  49. >       }
  50.  
  51. This code says to me that if any of these fields != then I have
  52. a valid library?? Can this be right.If I loadseg() say amigaguide.library
  53. then I get...
  54.  
  55. libres[-1]   == 0x70ff4e75,
  56. rt_MatchWord == RT_MATCHWORD
  57. rt_MatchPtr  == (APTR)libres
  58.  
  59. So that doesnt work.
  60.  
  61.  
  62. I also received the follwing from Martin Frost (thanks Martin)...
  63.  
  64. > >      ResLib=(struct Resident *)((LONG *)BADDR(LibSeg)+2);
  65. >
  66. > Don't you actually need
  67. >
  68. > for(ResLib=(struct Resident *)BADDR(LibSeg);
  69.  
  70. Getting ResLib this way allways fails for me.
  71. Plus I Dont know why you have this in a for() loop.
  72.  
  73. >   ResLib->rt_MatchWord==0x4AFC && ResLib->rt_MatchPtr==ResLib;
  74.                                             ^^^^^^^^^^^
  75.                                             rt_MatchTag
  76. >   (UWORD *)ResLib++);
  77. >
  78.  
  79. In looking at the includes (exec/resident.h) the comment beside
  80. rt_MatchWord is /* word to match on (ILLEGAL) */ Does this mean
  81. its illegal to use this field??
  82.  
  83.  
  84. Thanks again for any and all help...
  85.  
  86. Still many questions...isnt ignorance wonderfull!
  87.  
  88.   Norm.
  89.  
  90.  ---------------------------------------------------------------------
  91.   Norman Baccari             | "OK team! You start coding.           
  92.   normb@gpu.utcc.utoronto.ca | I'll go see what the user specs are." 
  93.   Toronto,Ontario,Canada     |                                        
  94.  ---------------------------------------------------------------------
  95.  
  96.  
  97.  
  98.