On 2013-10-26 01:32, niXman wrote:
I try to create the hooks for open()/fopen().

hook code:
#include <stdio.h>

#ifdef __CYGWIN__
#include <sys/cygwin.h>
#endif

int open(const char *fname, int mode, ...) {
     printf("fname=%s\n", fname);
}

FILE* fopen(const char *fname, const char *mode) {
     printf("fname=%s\n", fname);
}

#ifdef __CYGWIN__
__attribute__((constructor))
void _init(void)
{
  cygwin_internal(CW_HOOK, "open", open);
  cygwin_internal(CW_HOOK, "fopen", fopen);
}
#endif

HTH,


Yaakov


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to