On Saturday 24 June 2006 07:06, Christoph Probst wrote:
Hi.
Alexandre Julliard wrote:
You can't do that in general. In Unix a file can have multiple names, or even none at all, there's simply no way to get a filename from a handle. On Linux you can use /proc/self/fd but that's not very portable.
So what do you think about the solution that the wineserver stores the filename in the file object when the object is created?
Just like wine_server_handle_to_fd() there would be a wine_server_handle_to_filename() that returns the filename.
A way to possibly do what you want to do is to duplicate the file handle, and to hack on ClamAV to scan a file given a handle to it.
On unices you can open a file, hold a handle to it, and then remove the directory entry (rm file) -- the file will exist on the disk without a directory entry, for as long as the file handle is open. I don't think you could do that under e.g. Windows, so Unix is different here.
In general the only way to get at a file knowing its handle is to use a duplicate handle. That'd be the only robust way AFAIK.
Cheers, Kuba