Chuck Norris
Chuck Norris

Reputation: 15200

WNetOpenEnum does not return anything after root level

I have a C# code which enumerates through network neighborhood using WNetOpenEnum & WNetEnumResource. This does return "Microsoft Terminal Services", "Microsoft Windows Network" and "Web Client Network", but does not return anything for the Microsoft Windows Network level in Windows 10.

I can see connected shares in my Windows Explorer though. Problem is also described in this question, but there are no much answers - https://social.msdn.microsoft.com/Forums/en-US/6b2120f6-523e-4705-9231-fd19f05611eb/wnetopenenum-wont-enumerate-past-the-root-level-error-1231?forum=windowssdk

Looks like WNetOpenEnum does not work properly in Windows 10 anymore. How can I replace it? What Windows Explorer uses to show Network shares?

I read about NetUseEnum function, but there is a remark about it in MSDN

This function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseEnum function does not support Distributed File System (DFS) shares. To enumerate shares using a different network provider (WebDAV or a DFS share, for example), use the WNetOpenEnum, WNetEnumResource, and WNetCloseEnum functions.

Upvotes: 0

Views: 967

Answers (1)

Steel Rate
Steel Rate

Reputation: 11

I am having the same problem on my Win10 laptop. The problem occurred after installing Windows updates (KB4586781, KB4580419, KB4586864, KB4577266).

I found the following solution: You should initialize the SMBv1 protocol. For more details see https://social.technet.microsoft.com/Forums/en-US/6f102ed1-8e76-4cb7-8dec-05714466d441/net-view-system-error-1231?forum=win10itpronetworking

Upvotes: 1

Related Questions