1 /*
2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 package sun.jvm.hotspot.debugger.win32.coff;
26 
27 /** Models the information stored in the export directory table.
28     Ostensibly this is supposed to lie in the .edata section.
29     However, experience has shown that this data does not appear to be
30     present there, instead (likely -- not yet tested) showing up in
31     the Export Table portion of the OptionalHeaderDataDirectories.
32     (Some of the descriptions are taken directly from Microsoft's
33     documentation and are copyrighted by Microsoft.) */
34 
35 public interface ExportDirectoryTable {
36   /** A reserved field, set to zero for now. */
getExportFlags()37   public int getExportFlags();
38 
39   /** Time and date the export data was created. */
getTimeDateStamp()40   public int getTimeDateStamp();
41 
42   /** Major version number. The major/minor version number can be set
43       by the user. */
getMajorVersion()44   public short getMajorVersion();
45 
46   /** Minor version number. */
getMinorVersion()47   public short getMinorVersion();
48 
49   /** Address of the ASCII string containing the name of the
50       DLL. Relative to image base. See {@link #getDLLName}. */
getNameRVA()51   public int getNameRVA();
52 
53   /** Convenience routine which returns the name of the DLL containing
54       this export directory. */
getDLLName()55   public String getDLLName();
56 
57   /** Starting ordinal number for exports in this image. This field
58       specifies the starting ordinal number for the Export Address
59       Table. Usually set to 1. */
getOrdinalBase()60   public int getOrdinalBase();
61 
62   /** Number of entries in the Export Address Table. */
getNumberOfAddressTableEntries()63   public int getNumberOfAddressTableEntries();
64 
65   /** Number of entries in the Name Pointer Table (also the number of
66       entries in the Ordinal Table). */
getNumberOfNamePointers()67   public int getNumberOfNamePointers();
68 
69   /** Address of the Export Address Table, relative to the image
70       base. */
getExportAddressTableRVA()71   public int getExportAddressTableRVA();
72 
73   /** Address of the Export Name Pointer Table, relative to the image
74       base. The table size is given by Number of Name Pointers. */
getNamePointerTableRVA()75   public int getNamePointerTableRVA();
76 
77   /** Address of the Ordinal Table, relative to the image base. */
getOrdinalTableRVA()78   public int getOrdinalTableRVA();
79 
80   /** Returns the <I>i</I>th exported symbol (from 0..{@link
81       #getNumberOfNamePointers} - 1). These are arranged in sorted
82       order to allow binary searches. */
getExportName(int i)83   public String getExportName(int i);
84 
85   /** Returns the <I>i</I>th entry (0..{@link
86       #getNumberOfNamePointers} in the Export Ordinal Table.  This is
87       used for looking up a given symbol's address in the Export
88       Address Table; see {@link #getExportAddress}. */
getExportOrdinal(int i)89   public short getExportOrdinal(int i);
90 
91   /** Indicates whether the specified export address is really a
92       forwarder, in which case the value is not an address but a
93       string. */
isExportAddressForwarder(short ordinal)94   public boolean isExportAddressForwarder(short ordinal);
95 
96   /** Get the forwarder name for the given ordinal. Must be called
97       only if isExportAddressForwarder() returns true. */
getExportAddressForwarder(short ordinal)98   public String getExportAddressForwarder(short ordinal);
99 
100   /** <P> Takes in an ordinal from the Export Ordinal Table (see
101       {@link #getExportOrdinal}). This ordinal is biased by {@link
102       #getOrdinalBase}; however, the subtraction described in the
103       documentation is done internally for convenience. Returns an
104       address that is in one of two formats. If the address specified
105       is not within the export section (as defined by the address and
106       length indicated in the Optional Header), the field is an Export
107       RVA: an actual address in code or data. Otherwise, the field is
108       a Forwarder RVA, which names a symbol in another DLL. </P>
109 
110       <P> An Export RVA is the address of the exported symbol when
111       loaded into memory, relative to the image base. For example, the
112       address of an exported function. </P>
113 
114       <P> A Forwarder RVA is a pointer to a null-terminated ASCII
115       string in the export section, giving the DLL name and the name
116       of the export (for example, "MYDLL.expfunc") or the DLL
117       name and an export (for example, "MYDLL.#27"). </P>
118 
119       <P> NOTE: the value returned has been transformed from an RVA to
120       a file pointer which can be added to the image base to find an
121       absolute address for the symbol. </P> */
getExportAddress(short ordinal)122   public int getExportAddress(short ordinal);
123 }
124