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.
 
  • Post
  • Reply
Bula Vinaka
Oct 21, 2020

beach side
If this makes sense:

Application.exe loads Version.dll which is at version 2.x.

I want Application.exe to load Version.dll which is at version 3.x.

If I just replace the dll, the application gives the message "Wrong version of Version.dll" and quits.

Is it possible to create a symlink or use some kind of tool which will get the application to load Version.dll at version 3.x, while still making the application "think" that it's loading version 2.x?

I'm not doing anything unethical here, I'm trying to troubleshoot a problem and it's likely that a different version of the dll will work, but I can't know that unless I am able to actually get the application to load it.

I'm on Windows 10 2004 x64.

Adbot
ADBOT LOVES YOU

Bula Vinaka
Oct 21, 2020

beach side
After some Google searching it appears that what I want to do is associated with black hat hacker kinds of things, i.e., "hijacking a legitimate dll with a malicious one". Again, I don't have a "malicious" dll, it's just a different version I want to try to see if I can get an application to work properly.

Sorry if this is a bad idea for a thread (it probably is). :\

Khorne
May 1, 2002
Is the application checking the dll's version/checksum/whatever? If it's checking a literal version that's part of the dll's metadata, you can edit the 3.x dll to pretend to be the correct 2.x version. This used to be pretty simple in the xp days but admittedly I haven't dealt with this since then. There are/were programs that can do it. stackoverflow discussing this

It's possible the version check is more complicated than that. In that case, it's not as simple as the above.

Is the 3.x dll compatible with 2.x calls? This could pose a much bigger issue. Parameters, exported names, return types, etc can all change and major version number changes usually introduce breaking changes at some level.

Is the source code to either the application or the dll available?

Replacing it like you did works in most cases. In this case, the application probably needs to be modified in some way.

Khorne fucked around with this message at 00:33 on Feb 16, 2024

biznatchio
Mar 31, 2001


Buglord
Yes. Use DLL Redirection. Redirection is always the first thing checked when a DLL is being loaded into a process.

The short version: in the application's directory, create an empty file named filename.exe.local -- where the filename.exe portion of the name is the name of the actual executable you're going to be running. Then put whatever DLL you want to load in the directory too. When a .local file is present with the executable's name, then Windows will always check the application's directory for a DLL before it goes on to check the rest of the places it usually looks.

biznatchio fucked around with this message at 00:36 on Feb 16, 2024

Bula Vinaka
Oct 21, 2020

beach side
Yeah, it doesn't look like it's going to be possible. I tried Resource Hacker to change the metadata to the info of the dll it accepts, that didn't work.

The DLL Redirection doesn't apply I don't think, because the dll is already in the application directory. What I'm trying to do is replace that dll with a different version. The dll's file name will be the same. When I do that, the application is checking the dll and wanting to use only one specific version, so it exits when I try to replace it with a different version.

The exe will probably have to be patched, but so far, I'm unable to figure out how to do that (in x64dbg)... my skills are extremely weak. :(

Adbot
ADBOT LOVES YOU

Hughmoris
Apr 21, 2007
Let's go to the abyss!
If you'd like a goon to help write a small shim for you, you may have luck in the Request A Tiny App thread.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply