Is there a way I can open a device using CreateFile and the device's physical device name ( such as: \Device\000055 )? What would all the arguments to CreateFile be?
Printable View
Is there a way I can open a device using CreateFile and the device's physical device name ( such as: \Device\000055 )? What would all the arguments to CreateFile be?
CreateFile Function (Windows)
Google is your friend!
I have tried but it comes up with the error "file not found".
Are you formatting the drive name correctly?
In C, as a physical drive, named in a string literal you need "\\\\.\\PhysicalDrive0" to open drive C: You have to double the slashes because C uses the \ as an escape character like in \n ... so to get one slash you need 2.
Naming Files, Paths, and Namespaces (Windows)
If the device has a symlink in the Global?? namespace you can open it with CreateFile (with the symlink name, not the device path) assuming you have the correct user rights to open it.Quote:
Originally Posted by MSDN
If not then you have to use the NT api, like NtCreateFile, etc..