Tips for using Win32 Device Namespaces in APIs


stars-and-space-through-a-window

Win32 Device Namespaces

Device Access: \\.\

Similar to working with the files in /dev on a *nix system, use the “\\.\” prefix to access Win32 device namespaces instead of the standard Win32 file namespace that you get using single backslashes. Remember that you’re just specifying a handle, or an index to something in the kernel. A device could be specified for lpFileName to access a physical disk, for instance.

However, this is definitely implementation specific. You know the drill — be prepared for microsoft to pull the rug out from under your feet by changing the implementation in any service pack or update.

Escape Parsing: \\?\

For file I/O, the “\\?\” prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. The \\?\ can be a tricky one to work it as some APIs may not support it.


Posted on September 13th, by admica in microsoft.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">