Reputation: 145
I have read the code as following:
CreateFile("\\\\.\\PhysicalDrive0",
0,
FILE_SHARE_READ
NULL,
OPEN_EXISTING,
0,
NULL);
CreateFile("\\\\.\\C:",
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);
I do not understand the meaning of the path:
"\\\\.\\C:"
\\\\.\\PhysicalDrive0
Could you please help?
Thanks for your help
Upvotes: 2
Views: 17050
Reputation: 41
\\.\PhysicalDrive0 translates to \.\PhysicalDrive0 as a String. This location contains the Master Boot Record.
HANDLE MasterBootRecord = CreateFile("\\\\.\\PhysicalDrive0", GENERIC_ALL, FILE_SHARE_READ | FILE_SHARE_WRITE, //Get a handle on the MBR File
NULL, OPEN_EXISTING, NULL, NULL);
This is how to properly write the code.
Upvotes: 3
Reputation: 3375
\\
, in a string, is really just a single backslash, so the 'real' path names are \\.\C:
and \\.\PhysicalDrive0
.
That particular notation indicates raw device access: https://support.microsoft.com/en-us/kb/100027
Upvotes: 5