Reputation: 998
I want to read from already opened file. There are some examples available like general/ioctl in windows driver samples or How to open a file from a kernel mode device driver and how to read from or write to the file, but first passes file handle of file opened in user mode application (I obviously cannot open file opened by other application due to sharing violation error and handle is null), second shows sample of code without function parameters (I guess for EvtDeviceFileCreate(IN WDFDEVICE Device, IN WDFREQUEST Request, IN WDFFILEOBJECT FileObject)
function). Where and how I'm suppose to pass file name to work with file? I want to open it and read by offset plus block length.
Upvotes: 0
Views: 291
Reputation: 998
Somehow it wasn't obvious to me that DEVICE_NAME in
hDevice = CreateFileW(DEVICE_NAME,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
where
#define DEVICE_NAME L"\\\\.\\MYDRIVERNAME\\PathFileName"
is actually call to driver's EvtDeviceFileCreate function and
fileName = WdfFileObjectGetFileName(FileObject);
returns that filename parameter.
Upvotes: 0