Windows/C++: How do I determine the share name associated with a shared drive?

后端 未结 3 1872
说谎
说谎 2021-01-25 10:45

Let\'s say I have a drive such as C:\\, and I want to find out if it\'s shared and what it\'s share name (e.g. C$) is.

To find out if i

相关标签:
3条回答
  • 2021-01-25 11:37

    Use;

    SHGetFileInfo with SHGFI_ATTRIBUTES
    

    upon return check the dwAttributes flag for SFGAO_SHARE.

    I'm not sure how to find the actual path tho.

    0 讨论(0)
  • 2021-01-25 11:38

    If all else fails, you could always use NetShareEnum and call NetShareGetInfo on each.

    0 讨论(0)
  • 2021-01-25 11:46

    I believe you're looking for WNetGetConnectionA or WNetGetConnectionW.

    0 讨论(0)
提交回复
热议问题