Get drive letter from UNC path, and monitor shares creations

Whenever there is an access to a shared directory or mapped drive in
Windows XP , it always returns me a UNC path like
“UNC<sharename>\bla.txt”.
How can I get its equivalent drive letter? (like “c:”)

Also, I want to build a driver that monitors shares creations ( that
made by the user from the GUI or programmatically by calling
NetShareAdd() ).
Is there a way to do it? (do I need a file system driver ?)

Thanks

You can’t. Consider first that there may not BE a drive letter mapping.
Consider second that drive letter mappings are on a per-process basis
(with a higher layer that does “session level” sharing of those
mappings). Consider third that network naming has a whole layer of
aliasing issue where share names overlap. The UNC name is actually a
better choice than the drive letter name since it only suffers from the
aliasing issue.

Share creation is done via the MPR (multi-provider router) which in turn
calls DLLs. You don’t need a file system driver to deal with this
level, since it is all done in user mode. In fact, doing this at kernel
mode will likely be more difficult since the network provider to kernel
file system interface is private and thus you’d have to figure it out
for each different file system in which you were interested.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Omer B
Sent: Thursday, March 24, 2005 3:22 AM
To: ntdev redirect
Subject: [ntdev] Get drive letter from UNC path, and monitor shares
creations

Whenever there is an access to a shared directory or mapped drive in
Windows XP , it always returns me a UNC path like
“UNC<sharename>\bla.txt”.
How can I get its equivalent drive letter? (like “c:”)

Also, I want to build a driver that monitors shares creations ( that
made by the user from the GUI or programmatically by calling
NetShareAdd() ).
Is there a way to do it? (do I need a file system driver ?)

Thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com