I've created a new and different version of Yang's TCodeRedirect that I consider easier to work with, because it works as a singleton. This way, you won't need to create a new TCodeRedirect instance for each patch you apply during runtime.
I'm releasing the source code of this new TCodeRedirect class because many Delphi developers may use this technique in their own applications and frameworks, so here is it!
Chau Chee Yang covered most of TCodeRedirect utilization cases in his original blog post. What I've changed is: Using Yang's code you would call TCodeRedirect this way:
TCodeRedirect.Create(@MyOldProc, @MyNewProc);With my new TCodeRedirect, you may use it with another syntax, like this:
TCodeRedirect.GetInstance.AddPatch(@MyOldProc, @MyNewProc);This code was tested with Delphi 6, 7, BDS 2006 and XE2 but should work with other versions as well. Enjoy!
2 comments:
Noice Job, seems quite interesting because the can be extented to any framework.
Bom post Alexandre! Não estou conseguindo fazer o download da sua implementação do
CodeRedirect apartir do endereço que disponibilizou no seu blog http://alexandrecmachado.blogspot.com.br/2012/03/tcoderedirect-redux.html, no link http://www.alex7691.com/download/CodeRedirect.zip, por favor, se for possível, me envie o seu código pelo meu email! izaquemaciel@gmail.com, obrigado!
Post a Comment