Network Provider DLL: NPFormatNetworkName not called


I’m trying to get NPFormatNetworkName called so I can change the displayed name of my remotely mounted file system drive from Network Drive (X:) in the Common Open File dialog to something reasonable. I’ve added the enum interface to my NP DLL that gets called each time I open a common file dialog, and I return
X: - local name
\ADVirtualDisk\SHARRIS-L62DE - remote name
ADFS Redirector Network - Provider name

Am I correct in assuming that ‘X:’ is the local name I should be returning? As far as my other NETRESOURCE settings go, they are:

pBufferResource->dwScope = RESOURCE_CONNECTED;
pBufferResource->dwType = RESOURCETYPE_DISK;
pBufferResource->dwUsage = 0;

The Common Open File Dialog already knows I’m a remote drive based on the display icon it uses. I export NPFormatNetworkName as @36 in my NP DLL. I provide a count of 1 in my enum call as I only am exporting one resource at the current time.

Anyone have any ideas (or better yet, code examples) that show how this routine gets called?



PS My NP DLL seems to function correctly in other cases, for example the NPGetConnection gets called and Explorer shows the expanded name of the server correctly.

Is your NPGetCaps() implemented correctly? It should set flag WNNC_DLG_FORMATNETNAME in return value for WNNC_DIALOG.


Yes, I do set WNNC_DLG_FORMATNETNAME as my return value for WNNC_DIALOG, but there’s something else missing. Any ideas? Thanks!


Well, I just blew a good chunk of this morning trying to get this to work, alas. I was a bit excited because I determined that we need to register our NPFormatNetworkName function with the NP lib NPGetCaps call, and return WNNC_DLG_FORMATNETWORKNAME when WNNC_DIALOG gets passed in. I’m exporting the NPFormatNetworkName routine as @36 in my .def file, which I believe to be correct. So when I use the Common Open File dialog in Word, and then navigate and expand on My Computer, I see calls to NPGetCaps for WNNC_USER, WNNC_ADMIN, and (most significantly) WNNC_DIALOG, where I return WNNC_DLG_FORMATNETWORKNAME. I then see the 3 enumeration calls happen-NPOpenEnum, NPEnumResource, and NPCloseEnum. My values for the enum are the local drive “P:”, the server name \ADBOO\Goo, and the name of the redirector “ADFS Redirector Network”. I return a status indicating the enum worked correctly, and a count of 1 for resources. So, it does seem that our NP gets called first to indicate the capability, and then to see what resources it provides. What I don’t then see of course is the subsequent call into our NPFormatNetworkName routine. Most frustrating. Anyway, I hope this helps narrow down the scope of the problem for you reading this-I believe us to be very close based on the call pattern I’m seeing, but we’re still missing something else, unfortunately.



Try to put breakpoint into mpr!WnetFormatNetworkNameW/A if it is called at all. Try the similar scenario with lanman so you learn if system calls it. I guess explorer process is the best candidate.