Author Topic: Where does the program "name" come from?  (Read 442 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 1038
  • Karma: +24/-0
    • View Profile
Where does the program "name" come from?
« on: November 13, 2021, 04:41:54 pm »
So my Visual SlickEdit programmer's editor has from the very start always showed up in Theseus as "HELLO", see screenshot below.

Meanwhile, in the Tasklist and Taskbar it does show up with the proper name, however the icon is missing in both.

Not a big deal, but it kind of bugs me...LOL, so how the heck do I fix this?

I suspect something in the EXE stores this info, maybe a header record of some sorts? I simply do not know these details, but if anyone can give me a hint as to what to look for, I'll take it from there.

Any pointers?

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 1038
  • Karma: +24/-0
    • View Profile
Re: Where does the program "name" come from?
« Reply #1 on: November 13, 2021, 04:51:21 pm »
umm...I went to a couple of things I do know, such as EXEHDR, indeed that gives me the answer I am looking for I think...well, at least a partial answer.

Here is what I see:

Quote
Module:                          hello
Description:                    Visual SlickEdit
Executable format level:   0
CPU type:                       Intel 80386 or upwardly compatible
Operating system:           Operating System/2

Module type:                  Program
                                     NO internal fixups in executable image
Application type:             Uses PM Windowing API

So the follow-up to this is: how do I change that 'Module:' name?

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 13
  • -Receive: 229
  • Posts: 3217
  • Karma: +62/-0
    • View Profile
Re: Where does the program "name" come from?
« Reply #2 on: November 13, 2021, 05:24:48 pm »
So the follow-up to this is: how do I change that 'Module:' name?

You could binary edit it, with the limitation that it stays the same length or shorter, or relink it with a different module name in the def file.
Not sure what would happen if you blanked (replaced the ascii with nulls) the module name in a binary. Perhaps something could be done with the resources as well.

Lars

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 80
  • Posts: 865
  • Karma: +27/-0
    • View Profile
Re: Where does the program "name" come from?
« Reply #3 on: November 14, 2021, 12:02:20 pm »
As Dave said, for EXEs as well as DLLs, it is the module name in the binary that determines the "module" name. And yes, you better keep it to the exact same length it had before: clip the new name if it is too long and fill up with blanks if it is too short.
If you want to understand the OS/2 LX module format, see the OS/2 toolkit HTML file:
"IBM OS/2 16/32-bit Linear eXecutable Module Format (LX)"
and I seem to remember, the module name is the first entry in the "resident name table" (which is pointed to by the "RESIDENT NAME TBL OFF" in the LX header).

<quote>
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. These tables are used to translate a procedure name string into an ordinal number by searching for a matching name string. The ordinal number is used to locate the entry point information in the entry table.
</quote>

Any resource objects (linked to the EXE/DLL) do not have any bearing on the module name.

If you want to hack the binary, do not forget to unpack it first (with lxlite), then apply your changes and finally pack it again (with lxlite).
« Last Edit: November 14, 2021, 12:04:36 pm by Lars »

Rich Walsh

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 16
  • Posts: 153
  • Karma: +4/-0
  • ONU! (OS/2 is NOT Unix!)
    • View Profile
Re: Where does the program "name" come from?
« Reply #4 on: November 14, 2021, 07:44:00 pm »
If you want to hack the binary, do not forget to unpack it first (with lxlite), then apply your changes and finally pack it again (with lxlite).

If your only goal is to change the module name, this is totally unnecessary.

Open the file in a hex editor. At the top is the 'MZ' header (usually), followed by the 'LX' header. The very first recognizable word/string after the letters LX is the module name. In this case, the word "hello" will be immediately apparent. Change that to "vs" followed by 3 nulls, then save the file. (Note: I've seen cases where the preceeding wasn't true and the modulename was near the end of the file. That may have been done by lxlite.)

Lars

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 80
  • Posts: 865
  • Karma: +27/-0
    • View Profile
Re: Where does the program "name" come from?
« Reply #5 on: November 14, 2021, 10:35:28 pm »
Thank you for correcting me. The world would be a worse place without you.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 35
  • Posts: 1038
  • Karma: +24/-0
    • View Profile
Re: Where does the program "name" come from?
« Reply #6 on: November 15, 2021, 12:39:09 am »
Alright!!!

Thanks you guys. I replaced the 'hello' with 'VSE [null][null]', saved the changes and re-started to try out a bunch of functions (just in case there was some internal logic tied to the process name - luckily, none seem to be) and finally got rid of that annoying non-descritive name.