从 Windows 中的文件句柄获取文件路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1534744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting a file path from a file handle in Windows
提问by Wilson F
In Windows, is there a straightforward way to get the full path of a file, given only the file's handle?
在 Windows 中,是否有一种直接的方法来获取文件的完整路径,仅给出文件的句柄?
I can't use GetFinalPathNameByHandle() because that's Vista+ only and our product has to work on XP. However, something that simple, or close to it, would be best.
我不能使用 GetFinalPathNameByHandle() 因为那只是 Vista+ 并且我们的产品必须在 XP 上运行。但是,最好是简单的或接近于它的东西。
回答by Remy Lebeau
Here you go: Obtaining a File Name From a File Handle
给你:从文件句柄获取文件名