문제

Suppose I've got three UNC paths:

\\it\may\be\samba\on\linux.txt
\\maybe\its\on\windows\fileserver.txt
\\and\that\one\is\dfs.txt

How can I check (in c#) which one is a dfs mapping and which one isn't?

도움이 되었습니까?

해결책

Found a solution, but it has a drawback. A call to NetDfsGetInfo will return information on the dfs root (or link) if I pass in a dfs root (or link). If it's an UNC path not on dfs it'll return an error.

The only drawback is that returning that error takes about one second, returning dfs info produces an instant result.

If anyone wants to use this solution:
The docs on NetDfsGetInfo say that YOU MUST call NetApiBufferFree on the buffer returned, even if you get an error back.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top