home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / monitors / rsys / rsyssrc.lha / RSysHunks.c < prev    next >
C/C++ Source or Header  |  1993-09-24  |  15KB  |  705 lines

  1. /*
  2. ***************************************************************************
  3. *
  4. * Datei:
  5. *      RSysHunks.c
  6. *
  7. * Inhalt:
  8. *
  9. *      --- Globale Routinen ---
  10. *
  11. *    void HunkStruct ( void );
  12. *    void PrintHunkStruct ( char *file );
  13. *
  14. *      --- Lokale  Routinen ---
  15. *
  16. *    static int jumpinfile ( ULONG d );
  17. *    static int readlong ( ULONG *d );
  18. *    static int readtext ( char *d , long count );
  19. *    static long currentpos ( void );
  20. *    static struct hunkentry *makehunkentry ( struct hunkentry *last , char *name );
  21. *    static void MakeHunkList ( char *file );
  22. *    static void ScanHunks ( char *filename );
  23. *
  24. * Bemerkungen:
  25. *      Ermittlung der Hunkstruktur einer ausführbaren oder ladbaren Datei.
  26. *
  27. * Erstellungsdatum:
  28. *      07-Jul-93     Rolf Böhme
  29. *
  30. * Änderungen:
  31. *      07-Jul-93     Rolf Böhme      Erstellung
  32. *
  33. ***************************************************************************
  34. */
  35.  
  36. #include "RSys.h"
  37.  
  38. static struct hunkentry
  39. {
  40.     struct Node denode;
  41.     char *name;
  42.     struct hunkentry *next;
  43. };
  44.  
  45. static struct Remember *hekey = NULL;
  46.  
  47. extern struct Window *TreeWnd;
  48. extern struct Gadget *TreeGadgets[3],*TreeGList;
  49.  
  50. extern int decnt,breakit;
  51.  
  52. extern UBYTE *TreeWdt;
  53. extern UBYTE *TreeWdt1;
  54.  
  55. static struct hunkentry *loop, *firstde;
  56. static struct List Tree;
  57.  
  58. static enum ext_types1
  59. {
  60.     ext_def = 1,
  61.     ext_abs,
  62.     ext_res
  63. };
  64.  
  65. static char *ext_names1[] =
  66. {
  67.     "dummy   ",
  68.     "ext_def ",
  69.     "ext_abs ",
  70.     "ext_res "
  71. };
  72.  
  73. static enum ext_types2
  74. {
  75.     ext_ref32 = 129,
  76.     ext_common,
  77.     ext_ref16,
  78.     ext_ref8,
  79.     ext_dref32,
  80.     ext_dref16,
  81.     ext_dref8
  82. };
  83.  
  84. static char *ext_names2[] =
  85. {
  86.     "ext_ref32  ",
  87.     "ext_common ",
  88.     "ext_ref16  ",
  89.     "ext_ref8   ",
  90.     "ext_dref32 ",
  91.     "ext_dref16 ",
  92.     "ext_dref8  "
  93. };
  94.  
  95. static enum hunktypes
  96. {
  97.     hunk_unit = 0x3e7,
  98.     hunk_name,                          /* 0x3e8 */
  99.     hunk_code,                          /* 0x3e9 */
  100.     hunk_data,                          /* 0x3ea */
  101.     hunk_bss,                          /* 0x3eb */
  102.     hunk_reloc32,                      /* 0x3ec */
  103.     hunk_reloc16,                      /* 0x3ed */
  104.     hunk_reloc8,                      /* 0x3ee */
  105.     hunk_ext,                          /* 0x3ef */
  106.     hunk_symbol,                      /* 0x3f0 */
  107.     hunk_debug,                       /* 0x3f1 */
  108.     hunk_end,                          /* 0x3f2 */
  109.     hunk_header,                      /* 0x3f3 */
  110.     dummy,                              /* 0x3f4 */
  111.     hunk_overlay,                      /* 0x3f5 */
  112.     hunk_break,                       /* 0x3f6 */
  113.     dummy1,                              /* 0x3f7 */
  114.     dummy2,                              /* 0x3f8 */
  115.     dummy3,                              /* 0x3f9 */
  116.     hunk_lib,                          /* 0x3fa */
  117.     hunk_libindex                      /* 0x3fb */
  118. };
  119.  
  120. char *names[]=
  121. {
  122.     "hunk_unit",
  123.     "hunk_name",
  124.     "  hunk_code",
  125.     "  hunk_data",
  126.     "  hunk_bss",
  127.     "    hunk_reloc32",
  128.     "    hunk_reloc16",
  129.     "    hunk_reloc8 ",
  130.     "    hunk_ext",
  131.     "    hunk_symbol",
  132.     "  hunk_debug",
  133.     "hunk_end",
  134.     "hunk_header",
  135.     "dummy",
  136.     "hunk_overlay",
  137.     "hunk_break  ",
  138.     "dummy",
  139.     "dummy",
  140.     "dummy",
  141.     "lib_hunk",
  142.     "lib_index"
  143. };
  144.  
  145. static BPTR file;
  146.  
  147.     /*
  148.      * makehunkentry() erzeugt einen Listeneintrag aus einem Hunk
  149.      * einer ausführbaren Datei
  150.      */
  151. static struct hunkentry *
  152. makehunkentry(struct hunkentry *last, char *name)
  153. {
  154.     DPOS;
  155.  
  156.     if ((last = (struct hunkentry *) AllocRemember(ERKEY, ESIZEDE, MEMF_CLEAR | MEMF_ANY)) &&
  157.          (last->name = (char *)AllocRemember(ERKEY, strlen(name) + 1, MEMF_CLEAR | MEMF_ANY)))
  158.     {
  159.         strcpy(last->name, name);
  160.  
  161.         last->next           = NULL;
  162.         last->denode.ln_Name = last->name;
  163.         last->denode.ln_Type = 0;
  164.  
  165.         InitListView(TreeWnd,TreeGadgets[GD_TreeLV - GD_TreeLV],NULL,UNSETLVPOS);
  166.  
  167.         AddTail(&Tree, &last->denode);
  168.  
  169.         InitListView(TreeWnd,TreeGadgets[GD_TreeLV - GD_TreeLV],&Tree,decnt);
  170.  
  171.         decnt++;
  172.  
  173.         return last->next;
  174.     }
  175.     else ErrorHandle("Hunk memory", MEMORY_ERR, ALLOC_FAIL, KILL);
  176.  
  177.     return NULL;
  178. }
  179.  
  180.     /*
  181.      * jumpinfile() setzt den Dateizeiger um eine Anzahl ULONG's
  182.      * weiter vor
  183.      */
  184. static int
  185. jumpinfile(ULONG d)
  186. {
  187.     int serr;
  188.  
  189.     serr = Seek(file, d * sizeof(ULONG), OFFSET_CURRENT);
  190.     if (serr < 0) return FALSE;
  191.  
  192.     return TRUE;
  193. }
  194.  
  195.     /*
  196.      * readlong() liest ein ULONG aus einer Datei aus
  197.      */
  198. static int
  199. readlong(ULONG *d)
  200. {
  201.     return Read(file, d, sizeof(ULONG));
  202. }
  203.  
  204.     /*
  205.      * readtext() liest einen Text definierter Länge aus
  206.      * einer Datei aus
  207.      */
  208. static int
  209. readtext(char *d,long count)
  210. {
  211.     ULONG readdata[MAXSTRLEN];
  212.     int ret = 0,i,len = 0;
  213.     union {
  214.         ULONG ul;
  215.         unsigned char ut[4];
  216.     } cv;
  217.  
  218.     if(count == 0)
  219.     {
  220.         strcpy(d, field[NO_FIELD]);
  221.         return ret;
  222.     }
  223.  
  224.     ret = Read(file, readdata, count * sizeof(ULONG));
  225.  
  226.     d[0] = STRINGEND;
  227.     cv.ul = 0L;
  228.     cv.ul = readdata[0];
  229.     strncpy(d,(char *)cv.ut,4);
  230.     len +=4;
  231.     d[len] = STRINGEND;
  232.  
  233.     for(i = 1; i < count; i++)
  234.     {
  235.         cv.ul = 0L;
  236.         cv.ul = readdata[i];
  237.         strncat(d,(char *)cv.ut,4);
  238.         len += 4;
  239.         d[len] = STRINGEND;
  240.     }
  241.  
  242.     return ret;
  243. }
  244.  
  245.     /*
  246.      * currentpos() ermittelt die aktuelle Position des Dateizeigers
  247.      */
  248. static long
  249. currentpos(void)
  250. {
  251.     return Seek(file, 0L, OFFSET_CURRENT) - sizeof(ULONG);
  252. }
  253.  
  254.     /*
  255.      * ScanHunks() ermittelt alle Hunks eines ausführbaren Files und
  256.      * trägt diese in eine interne Liste ein
  257.      */
  258. static void
  259. ScanHunks(char *filename)
  260. {
  261.     ULONG data,
  262.             data2,
  263.             data3,
  264.             type,
  265.             typeofmem,
  266.             type_of_hunk,
  267.             lasthunk = hunk_name;
  268.     char    datatext[120];
  269.     int    error,
  270.             i,
  271.             z;
  272.     char    buffer[MAXFULLNAME],
  273.             blanks[10] = "  ",
  274.          *seek_err = "Seek() error!",
  275.             *memtype[3] = {"MEMF_CHIP","MEMF_FAST"};
  276.     int    ext_type,failure = 0;
  277.  
  278.     DPOS;
  279.  
  280.     sprintf(buffer, "File name : %s", filename);
  281.     loop = makehunkentry(loop, buffer);
  282.  
  283.     sprintf(buffer, "File size : %ld", SizeOfFile(filename));
  284.     loop = makehunkentry(loop, buffer);
  285.  
  286.     if (file = Open((UBYTE *) filename, MODE_OLDFILE))
  287.     {
  288.         error = readlong(&data);
  289.  
  290.         while ((error > 0) && NOT(ClickedCloseGadget()))
  291.         {
  292.             type = data - hunk_unit;
  293.             type_of_hunk = ((data << 8) >> 8);
  294.  
  295.             if ((type_of_hunk >= hunk_unit) && (type_of_hunk <= hunk_libindex) &&
  296.                  (type_of_hunk != hunk_end)  && (type_of_hunk != hunk_break))
  297.             {
  298.                 loop = makehunkentry(loop, (char *)field[BLANK_FIELD]);
  299.                 sprintf(buffer, "%s (o: \$%lx,\#%ld t: \$%lx,\#%ld)",
  300.                           names[type], currentpos(),
  301.                           currentpos(),data,data);
  302.                 loop = makehunkentry(loop, buffer);
  303.             }
  304.  
  305.             switch (type_of_hunk)
  306.             {
  307.                 case hunk_unit:
  308.                 case hunk_name:
  309.                     error = readlong(&data);
  310.  
  311.                     if((error > 0) && data)
  312.                     {
  313.                         error = readtext(datatext,data);
  314.                         sprintf(buffer, "  Name: %s",(char *)datatext);
  315.                     }
  316.                     else strcpy(buffer, "  Name: -");
  317.  
  318.                     loop = makehunkentry(loop, buffer);
  319.                     break;
  320.  
  321.                 case hunk_code:
  322.                 case hunk_bss:
  323.                 case hunk_data:
  324.                     typeofmem = ((data & (1L<<30)) ? 0 : 1);
  325.  
  326.                     error = readlong(&data);
  327.  
  328.                     sprintf(buffer, "    Size: \$%lx, \#%ld (%s)", data * 4, data * 4,memtype[typeofmem]);
  329.                     loop = makehunkentry(loop, buffer);
  330.  
  331.                     if (type_of_hunk != hunk_bss)
  332.                         if (NOT(jumpinfile(data))) loop = makehunkentry(loop, seek_err);
  333.  
  334.                     break;
  335.  
  336.                 case hunk_reloc32:
  337.                 case hunk_reloc16:
  338.                 case hunk_reloc8:
  339.                     error = readlong(&data);
  340.                     while ((error > 0) && data != 0L)
  341.                     {
  342.                         data2 = data;
  343.                         error = readlong(&data3);
  344.                         sprintf(buffer, "     \#%-3ld offsets in Hunk \#%-3ld", data, data3);
  345.                         loop = makehunkentry(loop, buffer);
  346.  
  347.                         if (NOT(jumpinfile(data2)))
  348.                         {
  349.                             loop = makehunkentry(loop, seek_err);
  350.                             break;
  351.                         }
  352.  
  353.                         error = readlong(&data);
  354.                     }
  355.  
  356.                     break;
  357.  
  358.                 case hunk_ext:
  359.                     error = readlong(&data);
  360.                     z = 0;
  361.  
  362.                     while(data && (error > 0))
  363.                     {
  364.                         ext_type = (int)(data >> 24);
  365.                         data = (data << 8) >> 8;
  366.  
  367.                         switch(ext_type)
  368.                         {
  369.                             case ext_def:
  370.                             case ext_abs:
  371.                             case ext_res:
  372.                                 error = readtext(datatext,data);
  373.                                 error = readlong(&data2);
  374.                                 sprintf(buffer, "      %s: %-22s val: %ld",
  375.                                             ext_names1[ext_type-ext_def+1],datatext, data2);
  376.  
  377.                                 loop = makehunkentry(loop, buffer);
  378.                                 break;
  379.  
  380.                             case ext_ref32:
  381.                             case ext_dref32:
  382.                                 error = readtext(datatext,data);
  383.                                 error = readlong(&data2);
  384.                                 sprintf(buffer, "      %s: %-22s refs: %ld",
  385.                                             ext_names2[ext_type-ext_ref32],datatext,data2);
  386.  
  387.                                 loop = makehunkentry(loop, buffer);
  388.  
  389.                                 if (NOT(jumpinfile(data2))) loop = makehunkentry(loop, seek_err);
  390.                                 break;
  391.  
  392.                             case ext_common:
  393.                                 error = readlong(&data);
  394.                                 error = readlong(&data2);
  395.                                 sprintf(buffer, "      %s (size): %ld  refs: %ld",
  396.                                           ext_names2[ext_type-ext_ref32],data,data2);
  397.                                 loop = makehunkentry(loop, buffer);
  398.  
  399.                                 if (NOT(jumpinfile(data2))) loop = makehunkentry(loop, seek_err);
  400.  
  401.                                 break;
  402.  
  403.                             case ext_ref16:
  404.                             case ext_ref8:
  405.                             case ext_dref16:
  406.                             case ext_dref8:
  407.                                 error = readtext(datatext,data);
  408.                                 error = readlong(&data2);
  409.                                 sprintf(buffer, "      %s: %-22s refs: %ld",
  410.                                             ext_names2[ext_type-ext_ref32],datatext, data2);
  411.  
  412.                                 loop = makehunkentry(loop, buffer);
  413.  
  414.                                 if (NOT(jumpinfile(data2))) loop = makehunkentry(loop, seek_err);
  415.                                 break;
  416.  
  417.                             default:
  418.                                 loop = makehunkentry(loop, "Unknown external reference!");
  419.                                 break;
  420.                         }
  421.  
  422.                         z++;
  423.                         error = readlong(&data);
  424.                     }
  425.  
  426.                     sprintf(buffer, "      External refs: %ld",z);
  427.                     loop = makehunkentry(loop, buffer);
  428.                     break;
  429.  
  430.                 case hunk_symbol:
  431.                     error = readlong(&data);
  432.                     z=0;
  433.                     while(data && (error > 0))
  434.                     {
  435.                         data = (data << 8) >> 8;
  436.                         error = readtext(datatext,data);
  437.                         error = readlong(&data);
  438.                         sprintf(buffer, "      Symbol: %-22s  val: %ld",
  439.                                   datatext,data);
  440.                         loop = makehunkentry(loop, buffer);
  441.  
  442.                         error = readlong(&data);
  443.                         z++;
  444.                     }
  445.  
  446.                     sprintf(buffer, "      External symbols: %ld", z);
  447.                     loop = makehunkentry(loop, buffer);
  448.                     break;
  449.  
  450.                 case hunk_debug:
  451.                     error = readlong(&data);
  452.                     sprintf(buffer, "  \$%lx, \#%ld",data * 4, data * 4);
  453.                     loop = makehunkentry(loop, buffer);
  454.  
  455.                     if (NOT(jumpinfile(data))) loop = makehunkentry(loop, seek_err);
  456.  
  457.                     break;
  458.  
  459.                 case hunk_end:
  460.                     if(lasthunk >= hunk_code && lasthunk <= hunk_debug) strcpy(blanks,"  ");
  461.                     else
  462.                         strcpy(blanks,"      ");
  463.  
  464.                     sprintf(buffer, "%s%s (o: \$%lx,\#%ld t: \$%lx,\#%ld)",
  465.                               blanks,names[type], currentpos(), currentpos(),data,data);
  466.  
  467.                     loop = makehunkentry(loop, buffer);
  468.                     break;
  469.  
  470.                 case hunk_header:
  471.                     error = readlong(&data);
  472.  
  473.                     while ((error > 0) && data != 0L)
  474.                         error = readlong(&data);
  475.  
  476.                     error = readlong(&data);
  477.                     sprintf(buffer, "  Count hunks : \#%ld",data);
  478.                     loop = makehunkentry(loop, buffer);
  479.  
  480.                     error = readlong(&data2);
  481.                     sprintf(buffer, "  First hunk  : \#%ld", data2);
  482.                     loop = makehunkentry(loop, buffer);
  483.  
  484.                     error = readlong(&data3);
  485.                     sprintf(buffer, "  Last hunk   : \#%ld", data3);
  486.                     loop = makehunkentry(loop, buffer);
  487.  
  488.                     for (i = data2; error && i <= data3; i++)
  489.                     {
  490.                         error = readlong(&data);
  491.                         if (error > 0)
  492.                         {
  493.                             sprintf(buffer, "    Hunk \#%ld, Length \$%lx, \#%ld",
  494.                                       i, data * 4, data * 4);
  495.                             loop = makehunkentry(loop, buffer);
  496.                         }
  497.                         else
  498.                         {
  499.                             sprintf(buffer, "    Hunk \#%ld, Length ??", i);
  500.                             loop = makehunkentry(loop, buffer);
  501.                         }
  502.                     }
  503.  
  504.                     break;
  505.  
  506.                 case hunk_overlay:
  507.                     error = readlong(&data);
  508.                     sprintf(buffer, "  Table size: \$%lx, \#%ld",data, data);
  509.                     loop = makehunkentry(loop, buffer);
  510.  
  511.                     if (NOT(jumpinfile(data))) loop = makehunkentry(loop, seek_err);
  512.  
  513.                     break;
  514.  
  515.                 case hunk_break:
  516.                     loop = makehunkentry(loop, (char *)field[BLANK_FIELD]);
  517.                     sprintf(buffer, "%s (o: \$%lx,\#%ld t: \$%lx,\#%ld)",
  518.                               names[type], currentpos(), currentpos(),data,data);
  519.                     loop = makehunkentry(loop, buffer);
  520.  
  521.                     break;
  522.  
  523.                 case hunk_lib:
  524.                 case hunk_libindex:
  525.                     error = readlong(&data);
  526.                     sprintf(buffer, "\$%lx, \#%ld", data * 4, data * 4);
  527.                     loop = makehunkentry(loop, buffer);
  528.  
  529.                     if (NOT(jumpinfile(data))) loop = makehunkentry(loop, seek_err);
  530.  
  531.                     break;
  532.  
  533.                 default:
  534.                     loop = makehunkentry(loop, (char *)field[BLANK_FIELD]);
  535.                     sprintf(buffer, "%s: \#%ld (\$%lX)", "Unknown hunk type position",
  536.                               currentpos(),currentpos());
  537.                     loop = makehunkentry(loop, buffer);
  538.                     failure++;
  539.  
  540.                     if(failure >= 5) Seek(file, 0L, OFFSET_END);
  541.                     break;
  542.             }
  543.  
  544.             lasthunk = type_of_hunk;
  545.  
  546.             error = readlong(&data);
  547.         }
  548.  
  549.         Close(file);
  550.     }
  551.  
  552.     return;
  553. }
  554.  
  555.     /*
  556.      * MakeHunkList() erzeugt aus einem ausführbaren File eine
  557.      * Liste aus den Hunks, aus denen das Executable besteht. Zuvor
  558.      * werden die Gadgets deaktiviert
  559.      */
  560. static void
  561. MakeHunkList(char *file)
  562. {
  563.     loop = firstde;
  564.  
  565.     if(SysWnd) PrintInfo("Scanning Hunks", SPEAK, 0);
  566.  
  567.     SetWindowTitles(TreeWnd, (UBYTE *) "<- Cancel reading Hunks...", NOSCREENTITLECHANGE);
  568.     EnableGadget(TreeWnd, TreeGadgets[GD_SaveGad - GD_TreeLV], FALSE);
  569.     EnableGadget(TreeWnd, TreeGadgets[GD_KindCY - GD_TreeLV], FALSE);
  570.  
  571.     ScanHunks(file);
  572.  
  573.     SetWindowTitles(TreeWnd, TreeWdt1, NOSCREENTITLECHANGE);
  574.     EnableGadget(TreeWnd, TreeGadgets[GD_SaveGad - GD_TreeLV], TRUE);
  575.     EnableGadget(TreeWnd, TreeGadgets[GD_KindCY - GD_TreeLV], TRUE);
  576.  
  577.     return;
  578. }
  579.  
  580.     /*
  581.      * PrintHunkStruct() bietet eine kleine Benutzeroberfläche an
  582.      * und ermittelt die Hunks eines Executables. Diese werden dann
  583.      * in einem ListView angezeigt
  584.      */
  585. void
  586. PrintHunkStruct(char *file)
  587. {
  588.     struct IntuiMessage *message;
  589.     ULONG class,
  590.             code;
  591.     APTR    object;
  592.     int id;
  593.  
  594.     DPOS;
  595.  
  596.    HandleHelp(MN_HunkStruct);
  597.  
  598.     Flags.quit_hunk = 0;
  599.  
  600.     NewList(&Tree);
  601.  
  602.     if (NOT(OpenTreeWindow(NULL, TRUE)))
  603.     {
  604.         PrintInfo("Scanning Hunks", SPEAK, 0);
  605.  
  606.       LockMainWindow(LOCK);
  607.  
  608.         decnt = 0;
  609.  
  610.         if(file)
  611.         {
  612.             InitListView(TreeWnd,TreeGadgets[GD_TreeLV - GD_TreeLV],NULL,UNSETLVPOS);
  613.  
  614.             breakit = FALSE;
  615.  
  616.             MakeHunkList(file);
  617.         }
  618.  
  619.         do
  620.         {
  621.             Wait(1L << TreeWnd->UserPort->mp_SigBit);
  622.  
  623.             while ((message = (struct IntuiMessage *) GT_GetIMsg(TreeWnd->UserPort)) != NULL)
  624.             {
  625.                 class = message->Class;
  626.                 code = message->Code;
  627.                 object = message->IAddress;
  628.  
  629.                 GT_ReplyIMsg(message);
  630.  
  631.                 switch(class)
  632.                 {
  633.                     case IDCMP_CLOSEWINDOW:
  634.                         Flags.quit_hunk = 1;
  635.                         break;
  636.  
  637.                     case IDCMP_GADGETUP:
  638.                         id = ((struct Gadget *)object)->GadgetID;
  639.  
  640.                   HandleHelp((enum RSysNumbers)id);
  641.  
  642.                         switch(id)
  643.                         {
  644.                             case GD_SaveGad:
  645.                                 if (GetFile(TreeWnd,"RAM:","RSys-Hunk.DAT","#?.dat",
  646.                                                 "Select File for saving hunklist","Save"))
  647.                                     SaveList(TreeWnd, (char *)_fullpath,
  648.                                                 (char *)"RSys-Hunk.DAT",&Tree, FALSE);
  649.                                 break;
  650.  
  651.                             case GD_KindCY:
  652.                                 InitListView(TreeWnd,TreeGadgets[GD_TreeLV - GD_TreeLV],NULL,UNSETLVPOS);
  653.  
  654.                                 NewList(&Tree);
  655.                                 FreeRemember(ERKEY, TRUE);
  656.  
  657.                                 decnt = 0;
  658.                                 breakit = FALSE;
  659.  
  660.                                 if (GetFile(TreeWnd,"C:","unknown","#?", "Select File for Hunk list","Show"))
  661.                                     MakeHunkList((char *)_fullpath);
  662.  
  663.                                 break;
  664.                         }
  665.                         break;
  666.  
  667.                     case IDCMP_VANILLAKEY:
  668.                         if((char)code == ESC) Flags.quit_hunk = 1;
  669.                         break;
  670.                 }
  671.             }
  672.         } while (NOT(Flags.quit_hunk));
  673.  
  674.         InitListView(TreeWnd,TreeGadgets[GD_TreeLV - GD_TreeLV],NULL,UNSETLVPOS);
  675.  
  676.         NewList(&Tree);
  677.         FreeRemember(ERKEY, TRUE);
  678.  
  679.         CloseASysWindow(&TreeWnd, &TreeGList, NULL);
  680.  
  681.       LockMainWindow(UNLOCK);
  682.     }
  683.     else ErrorHandle((char *)TreeWdt1, WINDOW_ERR, OPEN_FAIL, NO_KILL);
  684.  
  685.    PrintStatistics();
  686.  
  687.     return;
  688. }
  689.  
  690.     /*
  691.      * PrintHunkStruct() kann mit einem Parameter aufgerufen werden
  692.      * oder ohne. Kommt der Aufruf nicht vom RSysAppIcon, so wird kein
  693.      * Filename übergeben und der Aufruf wird von HunkStruct() aus
  694.      * getätigt
  695.      */
  696. void
  697. HunkStruct(void)
  698. {
  699.     DPOS;
  700.  
  701.     PrintHunkStruct(NULL);
  702.     return;
  703. }
  704.  
  705.