Question

I'm reading this. Here I've found some code lines, for example: wsprintf(szDrive, "\\\\.\\%c:", *lpszSrc); I want to ask, what does this string give?

I tried to look for information but all that I've found is:

In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming Files, Paths, and Namespaces.

and this do not answer into my question, so asking here. As I think it should be connected with windows specific or NTFS but not sure about that.

Was it helpful?

Solution

The %c is the single character format specifier for wsprintf.

The code is used to generate path names of this form:

\\.\C:

This is the path to a physical volume. You use such a path when performing file operations directly on a volume, bypassing the file system. So you'd use such a path when implementing raw disk copy, for example. The documentation for CreateFile has more detail.

This all ties in with the fact that the code you found this in performs a raw disk copy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top