Hello,
I have a strange problem with some code that calls WNetGetUniversalName. When I call the function I always get error 67 (ERROR_BAD_NET_NAME). But the network connection really does exist.
So from the scratch. I'm writing a Windows shell extension that shall do some stuff with text files that are located on a specified network drive. So when the IShellExtInit::Initialize method is called I store the dragged file and will then get the connection name by using the WNetGetUniversalName method.
So I can be really sure that the network drive does exist (as it comes from the DragQueryFile method).
Here's some code:
char buffer[4096];
REMOTE_NAME_INFO *info = (REMOTE_NAME_INFO*)buffer;
DWORD length = 4096;
info->lpConnectionName = NULL;
info->lpRemainingPath = NULL;
info->lpUniversalName = NULL;
DWORD error = WNetGetUniversalName(file, REMOTE_NAME_INFO_LEVEL, info, &length);
file is an ATL::CString that comes from the DragQueryFile method and error is always 67.
Odd thing is that it did work some days ago but not anymore, and I didn't change any of that code posted.