问题
I'm using win32file.CreateFile() to open up "file" that I see in process explorer.
The file in question is (as seen in proc explorer's handles and dlls view) : "\Device\ccSet_{}"
Q1. Can anyone shed light on what is \Device\<file name> . I believe these are obviously not files stored on the hard-disks somewhere. Unless I am wrong, what are they ?
Q2. When I try to use the path AS IS, in win32file.CreateFile() , it gives me an error "The system cannot find the specified path or file". Where am I going wrong.
Q3. Given an address of the above file object (again from proc explorer), can I read the file without specifying the path ?
the single line of code I am using is :
>>> win32file.CreateFile("Device\<filename>",w
in32con.GENERIC_READ|win32con.GENERIC_WRITE,win32con.FILE_SHARE_READ|win32con.FI
LE_SHARE_WRITE,None,win32con.OPEN_EXISTING,0,0)
回答1:
- The \Device\XXX names are the internal Windows NT device names.
- The
\\.\prefix will access the Win32 device namespace instead of the Win32 file namespace. For instance, to open COM10, you would need to use\\.\COM10. - The handle is only valid inside the process that opened it.
来源:https://stackoverflow.com/questions/11621671/win32file-createfile-the-system-cannot-find-the-specified-path