Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
SpaceClown
Feb 13, 2016

by FactsAreUseless
And I have no idea what the gently caress to do. I mean, I know I need an assembler and I have a makefile. Also I have an assembler (the one recommended by the makefile, TASM) but I have literally zero idea on how to link it to a makefile. I guess I could use visual studio but I don't own it and pirating it seems like a huge hassle.

Does anybody here have any information they could shed for me? I'd seriously do it myself but it's part of a huge overarching project and this is like the fifth task removed from the actual development of the project. To briefly sum up the current cascade of me being the most cucked fool alive:

I need custom graphics injected into this old game.
This requires fixing offsets that the EXE uses to store information about stuff in the graphics files.
The EXE is packed using Microsoft's EXEPACK utility
I have a toolchain that can fix the offsets for the EXE, but it relies on the EXE being unpacked a certain way and there's only one utility that can do it
I spent all day yesterday trying to get this utility to work, however it continually throws an error at me that it can't rename the temporary file and it just shuts everything down before it can unpack the EXE
I opened up the source for the utility, which is entirely in MASM and I have zero loving clue what is happening beyond the flag that throws the error
The utility comes with a super neat parameter in the source code that when enabled logs EVERYTHING that it does, which will tell me the exact point where it shits the bed
However I can't loving assemble this poo poo because it's antiquated as gently caress and I spent the last 3 hours trying to figure out how to assemble this piece of poo poo

My 1337 h4x sk1llz aren't super developed and I could really use some spoon feeding if anybody has a loving clue.

Adbot
ADBOT LOVES YOU

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Visual Studio is free for personal poo poo now so just download it:
https://www.visualstudio.com/vs/community/

Use ml.exe to assemble the asm file, if you need to link it with other things then use /c /coff to dump an obj file instead and feed that to the linker.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
Ya, the community version is free. You can just use ml.exe or if you want to use msbuild here's this guide on using masm in VS: http://www.kipirvine.com/asm/gettingStartedVS2015/index.htm

Do you just need to unpack the exepack'd file and fix the offsets, or is there some other spooky stuff going on? If you post the asm source I might be able to correct it or churn out a binary for you.

SpaceClown
Feb 13, 2016

by FactsAreUseless
i dunno if vs can compile for ms-dos though and thats what this utility was written for (it's a .com file)

https://files.catbox.moe/59x4z3.zip

here's the source with the original doc and .com file

as for what else needs to happen, its all covered by the toolchain im using. this is just a fulcrum of failure and its decently important for the polish of the finished project

otherwise i have to scrap all the current documentation of the unpacked exe, and not only start from square one with reverse engineering the drat thing, but i'd also end up manually doing all the work with a hex editor instead of a nice automated tool.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
Yeah you're right, unless you can use dosbox or something. The code is using dos api calls (int 21) to do file management among a few other silly things. You could replace all of the dos interrupts with win32 api calls, or port the code entirely, but that's probably the hard route to go for what you want to do.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
If you want to try running it under DOSBox, then you'll need to find a DOS linker. You can probably link it to an EXE instead and it might still work?

Try this maybe.
http://alink.sourceforge.net/

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
Actually the makefile says to use tasm and tlink. I shoulda known by the lack of WORD PTR JUST SO YOU KNOW [ax]

Oh you mention this! Have you tried getting ahold of tasm and dosbox and running
code:
tasm /m /w2 [files]
tlink /x /t iup.obj

dougdrums fucked around with this message at 03:05 on Jan 22, 2017

SpaceClown
Feb 13, 2016

by FactsAreUseless
i havent yet used tasm in dosbox, i fiddled with it in windows, will try it out in a short bit thanks for the suggestion

SpaceClown
Feb 13, 2016

by FactsAreUseless
update on that, I successfully got it to assemble.



It runs this for twelve thousand years

then it ends with this



logging was a lot less useful than i thought it was going to be...

im starting to think my only solution will be to spend some hours brute forcing the source to TRY and get it skip renaming the temp file and just write to the original.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
If I take the code for its word (I guess I'm not a very good dos hacker either :p) if you take out lines 928-947 in iup.asm:
code:
      ; erase old file
      mov ax, 4100h
      lea dx, [ProgName]
      int 21h
      jnc DeleteOK

      ERROR TxtCantDelete, 1

DeleteOK:
      mov ax, ds
      mov es, ax
      mov ax, 5600h
      lea dx, [TempFile]
      lea di, [ProgName]
      int 21h

      jnc RenameOK

      ERROR TxtCantRename, 1
... skips deleting and renaming the file that the FichierEXE procedure is writing to, so you should be left with the output, and you can rename it manually. Out of curiosity, after halting, did it produce any output files originally?

Adbot
ADBOT LOVES YOU

SpaceClown
Feb 13, 2016

by FactsAreUseless
No, it simply deleted the input file

  • Locked thread