can I detect wheather madexcept is used inside an delphi application by analyzing the exe file only ?
Is there a simple way by adding a few lines of code to my application and inform the final exe file user if madshi madexcept has been used or not
can I detect wheather madexcept is used inside an delphi application by analyzing the exe file only ?
Is there a simple way by adding a few lines of code to my application and inform the final exe file user if madshi madexcept has been used or not
If you use madexcept
with a Delphi application, there should be a resource entry: MAD->EXCEPT
in that executable.
To test an external application:
var
h: HMODULE;
h := LoadLibraryEx('c:\foo\bar.exe', 0, LOAD_LIBRARY_AS_DATAFILE);
if h <> 0 then
begin
if FindResource(h, 'EXCEPT', 'MAD') <> 0 then
ShowMessage('madexcept Found!');
FreeLibrary(h);
end;
To test inside your own application:
if FindResource(HInstance, 'EXCEPT', 'MAD') <> 0 then
ShowMessage('madexcept Found!');
Note that whis however will NOT tell you what options madexcept
uses. for example there could be an exception filter set to filter access violation exceptions, or a setting that will NOT check frozen threads etc...
You can do a plain text search for the text "madexcept". The easiest way to do that that I know of is with command line utilities. I would combine the strings and grep utilities like this:
C:\mydir>strings MyApp.exe | grep -i madexcept MadException MadExceptionT madExcept madExcept U9v;1 madExcept5 A madExcept madExcept madExcept1 c madExceptL c madExcept c madExcept c madExceptL c madExcept c madExcept madExcept c madExceptH This way madExcept can't install the thread hooks. .........
I personally use GnuWin32 as my source for these indispensable utilities.
If you are not a command line sort of a person, use Process Explorer. Run the executable and then run Process Explorer. Find the process and double click it. The brings up the Process Explorer properties dialog which contains a page named Strings. Select that page and click on the save button. Now you have a text file with all the strings in the executable in which you can search.
All this will tell you is that you compiled the madExcept code into your program. You won't know whether or not it is actually active.
If you look into a project options with madExcept enabled I believe that you will see the define madExcept used, eg in your program anywhere you can do:
{$IFDEF madExcept}
....
{$ENDIF}