开发者

What's the difference \\.\C: and \\.\C:\

开发者 https://www.devze.com 2023-01-14 14:47 出处:网络
In MSDN, StringMeani开发者_开发技巧ng \\\\.\\C:Opens the C: volume. \\\\.\\C:\\ Opens the file system of the C: volume.

In MSDN,

String Meani开发者_开发技巧ng

\\.\C: Opens the C: volume.

\\.\C:\ Opens the file system of the C: volume.

I could open \\.\C: volume device.

But I couldn't open \\.\C:\ directory by CreateFile.

How can I open the directory by CreateFile with \\.\ prefix.

And if I open the directory, what can I do by using the handle.

Are C:\ and \\.\C:\ same?


From the same MSDN page:

When opening a volume or removable media drive (for example, a floppy disk drive or flash memory thumb drive), the lpFileName string should be the following form: \.\X:. Do not use a trailing backslash (), which indicates the root directory of a drive. The following table shows some examples of drive strings.

Most likely since the WinAPI does not support the trailing backslash they mean the same but behave differently

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号