Technical question about EXEs and DLLs

If it doesn't fit anywhere else, drop it in here. (not to be used as a chat/nonsense section)

Moderator: Moderator Team

Post Reply
PurpleGurl
Posts: 1790
Joined: Fri Aug 07, 2009 5:11 am
Location: USA

Technical question about EXEs and DLLs

Post by PurpleGurl »

Yes, this is off-topic, but I am very curious. I was playing Dungeon Keeper, at least the version that Electronic Arts gave away as a freebie for a limited time. It used DOSBox so it would work under x64. It was buggy in that the mouse would randomly lose control and render the game unplayable. So I wanted to see if there were any alternative implementations and found Dungeon Keeper FX. They used a unique way of building it. They had converted the main executable to a DLL and called the portions they didn't write as replacements. I found their tutorial on how to pull this off, by modifying the header data, playing with the relocation table, modifying the entry point code, etc.

Now the question is this. Why does a 32-bit program calling what is presumably 16-bit code in a DLL run under x64? I mean, DOSBox is needed for the original to run under x64, but this 32-bit program which uses much of the original proprietary code works just fine without it.
menuhin
Posts: 22
Joined: Sun Dec 30, 2012 12:19 am

Re: Technical question about EXEs and DLLs

Post by menuhin »

Dos Games for DOSBOX are 16Bit
middings
Posts: 1073
Joined: Tue May 07, 2013 9:18 pm
Location: California, USA

Re: Technical question about EXEs and DLLs

Post by middings »

I am guessing that the code being called from the DLL is not 16-bit code.
User avatar
EmuandCo
Developer
Posts: 4723
Joined: Sun Nov 28, 2004 7:52 pm
Location: Germany, Bavaria, Steinfeld
Contact:

Re: Technical question about EXEs and DLLs

Post by EmuandCo »

You can't ein 16 Bit Code. Not by DLL, Not by exe File.
ReactOS is still in alpha stage, meaning it is not feature-complete and is recommended only for evaluation and testing purposes.

If my post/reply offends or insults you, be sure that you know what sarcasm is...
LuxenDM
Posts: 32
Joined: Sun Jan 01, 2017 9:29 pm

Re: Technical question about EXEs and DLLs

Post by LuxenDM »

they used a unique way of building it...

Sounds like they took the original's assets, and are ignoring the actual code of the game (which sounds like a lot of work) or are distributing their own interpretive emulator specific to that game (also sounds like a lot of work). Or maybe its something i dont know about yet.

I mean, i've come acrossed dune2 for android before (a 16bit dos game, if im not mistaken), and all it was was a specialised touch input thrown on top of some dos emulator built to autoboot and go straight to the game without letting the user know any better...
PurpleGurl
Posts: 1790
Joined: Fri Aug 07, 2009 5:11 am
Location: USA

Re: Technical question about EXEs and DLLs

Post by PurpleGurl »

I agree with Daniel here, and he should know, obviously, but what the author said makes no sense. They claim to have converted the original executable to a DLL, and call only portions of the internal functions. Thus their code provides some of its own functions and acts as a wrapper to the original code. I don't see how this is possible, and the story sounds a bit like something brown found on the ground behind a bull.

I wonder if the code wasn't 32-bit passing as 16-bit, or what?

As for assets, while they may have written many of their own as replacements or whatever, it still requires the original game. That's how the replacements get around the intellectual properties laws and all. While they can be called derivatives, they require the original software to work, so the original author is not impacted, and I've heard of no suits over this.
User avatar
Black_Fox
Posts: 1584
Joined: Fri Feb 15, 2008 9:44 pm
Location: Czechia

Re: Technical question about EXEs and DLLs

Post by Black_Fox »

One very simple explanation to this is they could have decompiled the original executable into a source code, fixed compilation errors when compiling into 32-bit executable, and from there on it's comparably easy.
PurpleGurl
Posts: 1790
Joined: Fri Aug 07, 2009 5:11 am
Location: USA

Re: Technical question about EXEs and DLLs

Post by PurpleGurl »

Ah yes, disassembly, makes sense now. Then reassemble for Win32 after removing anything "illegal," playing with fixups and relocations, changing the entry point code, fixing alignment issues, etc.
MadWolf
Posts: 688
Joined: Sat Dec 31, 2005 4:19 am
Contact:

Re: Technical question about EXEs and DLLs

Post by MadWolf »

hi
if i am looking at the right page if i was you do not trust this you may need to edit the Dosbox config to fix this bug or download Dos-Box the bug may have been fixed in an newer version of Dos-Box
PurpleGurl
Posts: 1790
Joined: Fri Aug 07, 2009 5:11 am
Location: USA

Re: Technical question about EXEs and DLLs

Post by PurpleGurl »

MadWolf wrote:hi
if i am looking at the right page if i was you do not trust this you may need to edit the Dosbox config to fix this bug or download Dos-Box the bug may have been fixed in an newer version of Dos-Box
I must have left out the part about me actually using the rewrite. But that was irrelevant to the story since I was asking how they pulled it off, not soliciting help finding a working copy. Dungeon Keeper FX doesn't have the bugs nor use DOSBox.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests