I've got a compiled dll file (dll binary) without source code. I have to delete some functions from this dll. Dll is written in C++.
For example, I've got Math.dll which contains 3 functions:
int Func1(int x);
int Func2(int x, int y);
double Func3(double x, double y);
I need to get new dll file with just one function:
int Func1(int x);
All I've got is Math.dll - one binary dll file.
Any tools or any methods to do that?
Update
I need to delete some functions because of several requirements:
Friends, here is solution works for me.
Solution
Step 1. Create new DLL project in, e.g. in Visual Studio
Step 2. Disassemble DLL binary (tools OllyDbg, IDA Pro)
Step 3. In new DLL project create new function with the same name as original function. Copy function Assembler code (from step 2) to new function as inlined assembly instructions
Step 4. Repeat step 3 for each function new DLL must contain
Step 5. Build DLL
Example
Step 2. Asm code
?Func1@@YAHH@Z proc near ;GetSquaredNumber
arg_0= dword ptr 8
push ebp
mov ebp, esp
mov eax, [ebp+arg_0]
imul eax, eax
pop ebp
retn
?Func1@@YAHH@Z endp
Step 3. New DLL C++ code
__declspec(dllexport) int Func1(int x) // GetSquaredNumber
{
int y_res = 0;
__asm
{
mov eax, [x]
push ebp
mov ebp, esp
imul eax, eax
pop ebp
mov [y_res], eax
}
return y_res;
}
Step 5. Build project!
Results: new dll contains just functions my application need and new dll size is reduced.