Is there a trick to loading signature files using a script?

Rip Cord

Staff member
So we can use the ida function ApplySig( ) in a idc script file.
Unfortunately, it seems the signature file is only put into the queue and not actually applied until after the script finishes running.
I want to be able to use the signatures in the same script that loads the signatures.

Sample script to apply disc_functions.sig which names several functions: config_check, ...

static load_function_signatures(void)
     auto result;
     auto name = "disc_functions.sig";
     result = ApplySig(name);

     if(result != 0) {
      Message("\nsignature %s loaded into ida's queue", name);
     } else {
      Message("\nWarning, signature %s could not be loaded", name);
          return 1;
     return 0;

static main(void)
     auto start;
     auto ret;

     ret = load_function_signatures();
     if(ret) return;

     start = LocByName("config_check");

     if(start == BADADDR) {
          Message("\nWarning, unable to locate function config_check");

     } else {  
          if(PatchDword( (start + 0x138), 0x40800003)) {
               Message("\ndword patched");
               MakeComm( (start + 0x138), "patched");

          } else {
               Message("\nWarning, dword not patched");

gives this output:
 Warning, unable to locate function config_check
then the signatures are applied after the script is already finished.

Is there a way to have it apply the signatures before the rest of the script runs?