What\'s the easiest way to get the filename associated with an open HANDLE in Win32?
If you need to do this on Win32 pre-Vista or Server 2008, look at the GetMappedFileName(...)
function, which is one of the best kept secrets in Win32. WIth a little C/C++-
fu, you can memory map a small portion of the file in question, and then pass that handle to this function.
Also, on Win32, you cannot really delete a file that is open (the open/unlink issue mentioned on another answer) - you can mark it for deletion on close, but it will still hang around until its last open handle is closed. Dunno if mapping (via mmap(...)
) the file in this case would help, because it has to point back to a physical file...
-=- James.