Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Overriding calls

I want to override system calls eg to monitor function calls : in this example, I'm overriding system:

int system(const char *s)
{
printf("System called: %s
", s);
//system(s);
return 0;
}

int main(void)
{
system("cmd");
}

My question is: how do I get My system function to call the "real" system call?

Comments

  • IDKIDK Member Posts: 1,784
    : I want to override system calls eg to monitor function calls : in
    : this example, I'm overriding system:
    :
    : int system(const char *s)
    : {
    : printf("System called: %s
    ", s);
    : //system(s);
    : return 0;
    : }
    :
    : int main(void)
    : {
    : system("cmd");
    : }
    :
    : My question is: how do I get My system function to call the "real"
    : system call?
    :

    This is one way:
    [code]
    int system_wrap(const char *s)
    {
    printf("System called: %s
    ", s);
    system(s);
    return 0;
    }
    #define system system_wrap
    [/code]
Sign In or Register to comment.