Today, working on some VB.NET code I had to access two external DLLs in order to use some methods. The help topics that I found told me to use the following external methods:
- shlwapi.dll → PathIsNetworkPath (Reference 1)
- mpr.dll → WNetAddConnection2 and WNetCancelConnection2 (Reference 2)
However, when I tried to call these methods from my code, I got an error saying that the entry point did not exist. So I did some research and I found out that the DLLs in my operative System (Windows 7 enterprise 32 bits) do not include these methods exactly, but instead, I got:
- PathIsNetworkPath → PathIsNetworkPathA / PathIsNetworkPathW
- WNetAddConnection2 → WNetAddConnection2A / WNetAddConnection2W
- WNetCancelConnection2 → WNetCancelConnection2A / WNetCancelConnection2W
So, I tested their behaviour: * Methods finishing with "A" work just as expected. * Methods finishing with "W" do not work as expected, they raise errors or return wrong results (g.i. "false" when it should be "true"). And yet however, nobody in the help topics mentions having a similar problem.
So I did a little research and in the MSDN documentation I found that the DLLs contain only the methods that finish with "A" and "W", and both of them, in the three cases that I use, the documentation pages are identical as far as I can see. As a matter of fact all along the page, they don't use the name of the method that ends with A/W but without it.
So my questions are: *why do I have methods "A" and "W" instead of the one without A/W in my DLLs? What's the difference between both of them? Why do methods "A" work for me while methods "W" don't?