Click here to Skip to main content
13,769,357 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

8.3K views
336 downloads
12 bookmarked
Posted 28 Mar 2017
Licenced CPOL

ProxiFy - Automatic Proxy DLL Generation

, 29 Mar 2017
Rate this:
Please Sign up or sign in to vote.
Automated proxy DLL generation with 64 and 32 bit DLL support

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 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:

  • Imagehlp.lib
  • dbghelp.lib

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionNice, but some fatal bugs Pin
big__bang7-Jun-18 5:28
memberbig__bang7-Jun-18 5:28 
QuestionCan't Build, it says "Unresolved external symbol RunASM" Pin
mockba.the.borg14-Dec-17 5:47
membermockba.the.borg14-Dec-17 5:47 
QuestionLink to Wrappit Pin
Rick York28-Mar-17 7:26
memberRick York28-Mar-17 7:26 
AnswerRe: Link to Wrappit Pin
Kristoffer Blasiak28-Mar-17 8:39
memberKristoffer Blasiak28-Mar-17 8:39 
GeneralRe: Link to Wrappit Pin
Rick York28-Mar-17 11:41
memberRick York28-Mar-17 11:41 
BugDownload link not working Pin
Bryian Tan28-Mar-17 4:11
mvpBryian Tan28-Mar-17 4:11 
GeneralRe: Download link not working Pin
Kristoffer Blasiak28-Mar-17 4:21
memberKristoffer Blasiak28-Mar-17 4:21 
GeneralRe: Download link not working Pin
Bryian Tan28-Mar-17 4:23
mvpBryian Tan28-Mar-17 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.181117.1 | Last Updated 29 Mar 2017
Article Copyright 2017 by Kristoffer Blasiak
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid