Hook dll and Objects
Hook dll and Objects
Hello
Anyone knows if it can cause some kind of problems? For example, if I inject the dll in a program compiled with C, what will happen? Does it have any other drawbacks?
Actually I need to use THashedStringList to store all opened handles and handle information as custom classes.
Thanks
Anyone knows if it can cause some kind of problems? For example, if I inject the dll in a program compiled with C, what will happen? Does it have any other drawbacks?
Actually I need to use THashedStringList to store all opened handles and handle information as custom classes.
Thanks
Objects are not a problem. Using VCL units with big initialization sections can be a problem. I recommend to stay away from SysUtils, Classes and Forms. If you must use some objects defined in some of those units, just copy the source code into your project file (*.dpr). You can check the size of your hook dll. Adding any of the mentioned units - without even using them - already increases the size of your hook dll. That is a sign of some code being executed during initialization of your dll which is not necessary and which can even be bad...
What he means is that if you use or need a function (say FunctionX) and it lives in SysUtils.pas, instead of including SysUtils.pas, simpley open up SysUtils.pas, find FunctionX code and copy and paste it into your applications .dpr file.
By doing this, your getting a copy of the required code. This is a common hack for functions like StrToIntDef() to avoid having to include SysUtils
Mike C
By doing this, your getting a copy of the required code. This is a common hack for functions like StrToIntDef() to avoid having to include SysUtils
Mike C
Why?Davita wrote:I need to use Classes.pas unit anyway.
It has a big initialization section and includes further units with more initialization sections. That means loads of code is executed in every process when your hook dll is injected. That's bad and can eventually even lead to stability problems with some specific processes.Davita wrote:is this a huge drawback? what problems I will face?