I am trying to programmatically allow sharing to a public type of sharing on a device that matches a known GUID on a Windows 7 machine.
API at: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365944(v=vs.85).aspx
The error list shows the following: E_ABORT, E_FAIL, E_INVALIDARG, E_NOINTERFACE, E_NOTIMPL, E_OUTOFMEMORY, E_POINTER and E_UNEXPECTED.
The error code that I return is 0x80040201, which resolves: "The event failed to call any of the subscribers." which does not seem to match any of the above error codes.
If I manually go into the properties of network adapters and go to the sharing tab and enable sharing and select a private network and click "OK", sharing will be enabled.
After that, my above code works without problems.
I can even manually set up sharing with another adapter (public) and another private network, and then run my code and see that my code updates the public and private networks to what I want. This seems to work only after sharing is first allowed manually through the network properties panel.
The problem is duplicated on two different computers running Windows 7 64 bit. It seems like after removing the network adapter driver from the system when sharing is enabled on it, then reinstall the network adapter driver.
I tried to disable the uninstaller when uninstalling, but it seems successful or missed.
The Windows network sharing properties panel does something behind the scenes that this API call does not, because it manually configures the sharing on the adapter.
Does anyone have any idea what this might be?