Introduction
ProxiFy allows the user to quickly create a proxy DLL that uses either 64 bit or 32 bit DLLs. It generated the necessary ASM code to make the DLL work in both architectures. It also doesn't make use of dumpbin to generate the exports for the DLL. So there are no additional steps than just selecting the DLL you want to make a proxy of.
I made this project quite quickly and have found it useful for myself, and figured someone else might find it helpful.
Background
I used to create my proxy DLLs using "wrappit" by Michael Chourdakis but found that it doesn't support 64 bit architecture DLLs and it was a bit slow for my taste in terms of how many steps were needed to create a DLL (sometimes, I would have to create several, and using dumpbin to generate the exports was a bit of an annoyance).
I use the same technique of using a jmp to jump to the exported address, and it's heavily inspired by wrappit.
Compiling ProxiFy
To compile ProxiFy, make sure you include the following libs:
and set the Character Set to "Use Multi-Byte Character Set".
Using ProxiFy
Using ProxiFy is very easy, the idea behind it was to shorten the amount of steps needed to create a proxy DLL.
All you need to do is run ProxiFy.exe and you will be prompted to select a .dll file.
Step 1
Once the DLL has been selected, you will receive a messagebox
saying either "32 bit file" or "64 bit file". The only purpose of this messagebox
is to let the user know what architecture of DLL they just created a proxy of. I found this somewhat useful, but you can remove it if you want in the source, it has no other purpose.
Step 2
Result
ProxiFy will create 3 files if it's a 64 bit DLL, and 2 files if it's a 32 bit DLL. I will go over how to create a proxy DLL project below, I am using Visual Studio 2015 for this example.
Step 1
First create a DLL project, I won't go over how to do this as there are several great articles on this topic.
Step 2
Once you have done that, add the .cpp file and the .def file to the project. Make sure to go into the linker settings and setting the .def file as the Module Definition File. You find this option under Properties -> Linker -> Input.
If the project is a 32 bit project, make sure to set the project as Win32 (or x86). Then you are done.
Additional Steps for 64 bit DLLs
Step 1
If you have a 64 bit DLL, a .asm file was created alongside the .cpp and .def files. Before you add this to the project, you should right click the project -> Build Dependencies -> Build Customizations... and then check ".masm". This will allow the .asm file to work correctly.
Step 2
Now add the .asm file to the project as well. I'm not sure if the correct settings are set automatically, so to double check, right click it and go to properties. And under "General -> Item Type", make sure it's set to: Microsoft Macro Assembler.
PS
As this is a proxy DLL, it needs the original DLL in the same folder. ProxiFy assumes that you will have the original DLL with an underscore after the name. So steam_api64.dll will instead become steam_api64_.dll.
This can be changed either in ProxiFy or you can just change the LoadLibrary
call in the resulting CPP file.
Points of Interest
The project does NOT work with DLLs that are using ordinals for their exports. This can be done but so far I have not had any problems not using ordinals for the exports. It's discouraged in general from what I can tell, so I haven't included it as I haven't needed it yet.
I have only tested ProxiFy on Windows 7, 64 bit.
History
- 2017-03-28: Original post
- 2017-03-29: Updated bug in the generation of 32 bit dlls