Ok, somewhat easy task, but i dont know how to do it. Basically i need to take a currenty written dll file ( which i dont hae the source code for) and i need to copy all of the original content and i need to import some functions from another dll, i know what i need to import, i just dont know how to add this to te current dll, or how to copy all the contents into a new file so ican write the new dll. I am using microsoft visual studios and would appreciate any help i can get :). ( it maybe exporting or importing, im not sure) maybe a tutorial on how to write one and any specific information? Ty
Oh yeah, i was also told somethig about a loadlibrary? No idea what that is...
Dont know if thats even possible but I do know how to make the DLL a resource and then have the program extract the Dll when needed... Your basically asking for the decompilation of the DLL
You can't decompile a DLL or *.exe, the most you can hope for is to get its assembly language code.
Let's say the name of the original DLL is A.DLL and you want to write B.DLL. All you have to do is have B.DLL call the functions in A.DLL in the same way that any *.exe will call functions in B.DLL. Ib you have A.LIB that is supplied with A.DLL then the job is easy -- just link B.DLL with A.LIB. If you do not have A.lib then you will have to first call win32 api LoadLibrary() and then GetProcAddress() for each function you want to call in A.DLL.
Ok, so basically i have to make a new dll that calls all of the old functions then add the new calls, do u happen to have a good tutorial for making dlls? Ty for the help :)
As AD said you can't de-compile C/C++ compiled code.
You can "re-package" a library only if it's static library, not dynamic.
OP>> "I am using microsoft visual studios"
Given what you're trying to do I recommend you export the makefile and have a look to see what's happening behind the scenes.
VS would give you options to create projects from templates (static/dynamic-lib or exe project). Just create each type export make file and see how/with-what-options does VS invoke compiler/linker. If you figure that much out, then it's easy to implement what AD said.
Although it's easier to figure out the exported names from a dll using nm. E.g.
D:\Program Files\CodeBlocks8.0.2\MinGW\bin>nm -V GNU nm (GNU Binutils) 126.96.36.19980109 Copyright 2007 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. D:\Program Files\CodeBlocks8.0.2\MinGW\bin>nm.exe -g -C "D:\Program Files\CodeBlocks8.0.2\MinGW\bin\mingwm10.dll" 6fbc17e8 T _AddAtomA@4 6fbc17c8 T _DeleteCriticalSection@4 6fbc1300 T _DllMain@12 6fbc1060 T _DllMainCRTStartup@12 6fbc1800 T __CTOR_LIST__ 6fbc180c T __DTOR_LIST__ 6fbc30c0 R __RUNTIME_PSEUDO_RELOC_LIST_END__ 6fbc30c0 R __RUNTIME_PSEUDO_RELOC_LIST__ 6fbc1800 T ___CTOR_LIST__ ......snip........ 00100000 A __size_of_heap_reserve__ 00001000 A __size_of_stack_commit__ 6fbc1798 T _abort 6fbc1110 T _atexit 6fbc1788 T _calloc 6fbc1768 T _fflush 6fbc1770 T _free 6fbc1780 T _malloc 6fbc17a0 T _memset D:\Program Files\CodeBlocks8.0.2\MinGW\bin>
Sorry but i am a complete novice @ this, and i was wondering if you had any "recommended" tutorials. So i spoke with the developer this morning (he is on vacation) and he always has me run before i can walk @ this stuff.
So these were his latest insctructions, "Export all entrypoints that d3d9.dll has, your dll needs to do two things 1) Load voobly launch2, 2) Load os d3d9.dll and forward calls to real d3d9.dll"
So from those instructions i assume he wants me to to add these extra exports that are currently missing in the launch2.dll file (which I have the source to). He also sent me this command, i am kinda confused on this part.
dumpbin /exports c:\windows\system32\d3d9.dll <-- to get exports
Where do i put that in my source code? How do i load another dll? I think i can follow the exporting new functions from the example he sent me....i appreciate the help :)
From the description it seems like you should create a new library (launch2.dll) that has
- all functions (entrypoints) with same signatures as in d3d9.dll (lets call them wrapper / delegator functions) +
- new functions that belong to launch2 introduces.
Implementation of wrapper functions should be just call corresponding / real function in d3d9.dll. This can be done as AD described.
Creation of DLL is simple. Just google. At a high level (irrespective of OS) C++ code goes thru following flow:
- Write .cxx/cpp/C (source) files.
- Compile source files to generate one .o file (object) per source. Using compiler.
- Link the .o files using linker and create .exe or .dll as you wish. You have the option to choose what you want to create from .o file. This is controlled by the arguments passed to the linker. If you pass XXX it creates .exe if you pass YYY it creates .dll.
- Only note that if you want to create a .exe the linker expects a special entrypoint (main()) in one (and only one) of the .o file.
Just noticed that AD also posted How to create DLL..