3

In my IDC script I open a log file, do some analysis, write in the file and close the file like this:

main(){
open_log();
do_analysis();
close_log();
}

Currently I am using this script on command line, and I am trying to close the GUI after analysis(or be more exact, don't not open GUI while analyzing)

Here is command line I use:

"z:\ida6.1\idaq.exe -A -SfunctionEnumeration.idc z:\Linux\targetfile"

I modified my script like this:

main(){
open_log();
do_analysis();
close_log();

Wait();
Exit(0);
}

Currently it will generate the log file, but no content in it..

It seems that IDA Pro is closed before the write operation(or close operation) on the log file, but I don't understand why because Wait() is called in my script...

I read the IDC manual and haven't find anything useful...

Could anyone give me some help? Thank you!

1 Answer 1

3

Try

main(){
Wait();
open_log();
do_analysis();
close_log();
Exit(0);
}
3
  • Why does this work when the other does not?
    – fileoffset
    Feb 7, 2014 at 3:51
  • 1
    @fileoffset: Wait() waits for IDA's auto-analysis to finish before continuing IDC code execution. The code in the question logged its data before auto-analysis was finished; the code in the answer logs its data after auto-analysis is finished by calling Wait() first. Feb 7, 2014 at 4:03
  • Ahh, righto, makes sense. IDA's API is not what I would call intuitive :)
    – fileoffset
    Feb 11, 2014 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.