File access redirection This one ought to be a little more of a challenge than your normal "compute these numbers" or "print this sequence of text" puzzles:  

Write a program that launches another program and when that other program tries to access a certain file the program causes it to open a different file.

Example:

The program launches Notepad.
Notepad attempts to open "orange.txt"
The program detects it and makes notepad open "green.txt" instead.  

Rules:
WinAPI is allowed, but your code will stand out better if you can get this some other way.
You can use any language, but it must be able to run on either Windows or Linux
gdb, 108 chars

star
b open if !(int)strcmp(((char**)$esp)[1],"orange.txt")
comm
set((char**)$esp)[1]="green.txt"
c
end
c
q


Save as the file redirect and run like this:

gdb -x redirect &lt;program you want to redirect&gt;


Works on x86 (linux at least, and probably Windows/Mac also).  Here's what the lines do:

star = start gets to the beginning of main (needed so open is defined for the next step).

b open if... = break if we're calling open on orange.txt

comm = command the code up to the next end is executed when the breakpoint fires.

set ((char*))... = replace the open argument with green.txt

c=continue

q=quit