Groups | Search | Server Info | Login | Register


Groups > comp.os.os2.programmer.misc > #1850

Re: loader

From Paul Edwards <mutazilah@gmail.com>
Newsgroups comp.os.os2.programmer.misc
Subject Re: loader
Date 2024-02-24 11:38 +0800
Organization A noiseless patient Spider
Message-ID <urbocg$10hfb$1@dont-email.me> (permalink)
References <ur1mqi$2ddfu$1@dont-email.me> <urb5bb$p95e$1@dont-email.me>

Show all headers | View raw


On 24/02/24 06:14, Paul Edwards wrote:
> On 20/02/24 16:10, Paul Edwards wrote:
>
>> 0001C0  EA08444F 5343414C 4C530000 83EC0489  ..DOSCALLS......
>
>> although I have no idea then what the trailing x'08'
>> would be before DOSCALLS.
>
> Ok, I know what it is now. It's a 1-byte length
> field of the name "DOSCALLS", which, as per
> 2.13 Import Module Name Table, is not NUL-terminated.
>
> So those two extra x'00' before the actual code
> starts at x'1cc' are likely padding bytes.

And that offset 1c1 where the import module name table
starts, can be found, is supposedly at 70H in the header.

Which puts it at F0:

000080  4C580000 00000000 02000100 00000000  LX..............
000090  00020000 02000000 01000000 00000000  ................
0000A0  03000000 00080000 00100000 00000000  ................
0000B0  23000000 00000000 64000000 00000000  #.......d.......
0000C0  C4000000 03000000 0C010000 00000000  ................
0000D0  1C010000 00000000 1C010000 27010000  ............'...
0000E0  00000000 00000000 28010000 34010000  ........(...4...
0000F0  41010000 01000000 4A010000 00000000  A.......J.......
000100  CC010000 00000000 00000000 00000000  ................
000110  00000000 02000000 00000000 00000000  ................
000120  00000000 00000000 00000000 00080000  ................

where we can see 0141. I see an interesting 01CC
(ie where my code is) on the next line, which would
be "data pages offset". Not sure what that is.

So back to the 141. I know I need to get to 1C1.
So I'm off by x'80'. So I just need to subtract
the DOS header - cool - the x'141' is the offset
from the LX header.

So trying the x'1cc' again - maybe the data is
loaded at an offset 0x80 from the code, and so
that's the final spot for it? And perhaps the
LX header is expected to be loaded into memory too.

That would require all the other tables to be loaded
too, which would be odd - especially all the relocation
entries which don't serve any purpose once the application
is loaded.

You can always adjust for that though.

Maybe it is set up for a lazy load, and just the data
needs to be memmove'ed to the proper offset if you do
that. Seems odd to be moving it just that small amount
though. ie after accounting for the code, maybe moving
it x'60' bytes. Doesn't sound like a very sensible
alignment.

I see 011c mentioned a couple of times earlier. So
that (likely) corresponds to 019c in the hexdump.
The program name? Someone is interested in that?
Ok, so:

0000D0  1C010000 00000000 1C010000

subtract 80 and you get 50 and 58.

"resource table offset" and "resident
name table offset"? Maybe these are just
dummy pointers, and there is a length
specifier to say the table is empty.

Ok, header x'54' is indeed the number of entries,
and so that (D4 above) is indeed 0, so it's
basically non-existent.

So only the "resident name table offset" is real
perhaps - I don't see a number of entries for it,
so I don't know what that might be.

RESIDENT NAME TBL OFF = DD Resident Name Table offset.
This offset is relative to the beginning of the linear EXE header

Smells correct.

And yes ...

The resident and non-resident name tables define the ASCII names and 
ordinal numbers for exported entries
in the module. In addition the first entry in the resident name table 
contains the module name.

... the module name is a special first entry.

And indeed, there is no number of entries because:

LEN = DB String Length.
This defines the length of the string in bytes. A zero length indicates 
there are no more entries in
table.

000130  00000000 00000000 00000000 00000000  ................
000140  00000000 28000000 00000100 05200000  ....(........ ..
000150  01000000 01000000 00000000 0C000000  ................
000160  00000200 03200000 02000000 01000000  ..... ..........
000170  00000000 00080000 00000300 03200000  ............. ..
000180  03000000 00000000 00000000 00000000  ................
000190  27000000 27000000 0A000000 076F7332  '...'........os2
0001A0  74657374 00000000 00000000 0D000000  test............
0001B0  0D000000 08011000 011A0108 811C0001  ................
0001C0  EA08444F 5343414C 4C530000 83EC0489  ..DOSCALLS......
0001D0  E0506A09 68000002 006A01E8 00000000  .Pj.h....j......
0001E0  83C4106A 006A01E8 00000000 83C40883  ...j.j..........
0001F0  C404C368 690D0A61 62630D0A 00        ...hi..abc...

Still more stuff to be fleshed out.

BFN. Paul.

Back to comp.os.os2.programmer.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

loader Paul Edwards <mutazilah@gmail.com> - 2024-02-20 16:10 +0800
  Re: loader Peter Flass <peter_flass@yahoo.com> - 2024-02-20 17:45 -0700
    Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-21 10:51 +0800
  Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 06:14 +0800
    Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 11:38 +0800
  Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 15:24 +0800
    Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 15:46 +0800
      Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 16:30 +0800
        Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 23:30 +0800
        Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-24 23:28 +0800
          Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-26 06:56 +0800
            Re: loader Peter Flass <peter_flass@yahoo.com> - 2024-02-27 15:41 -0700
              Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-28 12:50 +0800
                Re: loader Dave Yeo <dave.r.yeo@gmail.com> - 2024-02-28 14:04 -0800
                Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-29 06:56 +0800
                Re: loader Dave Yeo <dave.r.yeo@gmail.com> - 2024-02-28 19:11 -0800
                Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-02-29 11:46 +0800
                Re: loader Dave Yeo <dave.r.yeo@gmail.com> - 2024-02-28 23:02 -0800
                Re: loader Paul Edwards <mutazilah@gmail.com> - 2024-03-01 07:15 +0800
                Re: loader Dave Yeo <dave.r.yeo@gmail.com> - 2024-02-28 14:20 -0800
              Re: loader Dave Yeo <dave.r.yeo@gmail.com> - 2024-02-28 13:52 -0800
                Re: loader Peter Flass <peter_flass@yahoo.com> - 2024-02-28 17:43 -0700

csiph-web