How to get name associated with open HANDLE

后端 未结 7 613
终归单人心
终归单人心 2020-11-27 06:13

What\'s the easiest way to get the filename associated with an open HANDLE in Win32?

7条回答
  •  天命终不由人
    2020-11-27 06:40

    edit Thanks for the comments about this being Vista or Server 2008 only. I missed that in the page. Guess I should have read the whole article ;)

    It looks like you can use GetFileInformationByHandleEx() to get this information.

    You'll likely want to do something like:

    GetFileInformationByHandleEx( fileHandle, FILE_NAME_INFO, lpFileInformation, sizeof(FILE_NAME_INFO));
    

    Double check the MSDN page to make sure I haven't misled you too badly :)

    Cheers,

    Taylor

提交回复
热议问题