so straight to the point i have created a kernel driver that maps shared section to user mode. my problem is am trying to read/write memory with the driver but i have 0 experience with ReadFile , WriteFile . i have a handle that was created with CreateFileA.
now i my old project driver i used to communicate with IOCTL code something like this .
#define IO_READ_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0x0701 /* Our Custom Code */, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
typedef struct _KERNEL_READ_REQUEST
} KERNEL_READ_REQUEST, *PKERNEL_READ_REQUEST;
template <typename type>
type ReadVirtualMemory(ULONG ProcessId, ULONG ReadAddress,
if (hDriver == INVALID_HANDLE_VALUE)
DWORD Return, Bytes;
ReadRequest.ProcessId = ProcessId;
ReadRequest.Address = ReadAddress;
ReadRequest.Size = Size;
if (DeviceIoControl(hDriver, IO_READ_REQUEST, &ReadRequest,
sizeof(ReadRequest), &ReadRequest, sizeof(ReadRequest), 0, 0))
and yeah i know this is pasted from kernelbhop but this is what my driver does the same (old one).
now how could i do the exact same process but without IOCTL code and with only ReadFile , WriteFile . and 1 more thing , before i used to call my IOCTL code from kernel
if (ControlCode == IO_READ_REQUEST)
but as far as i know i can't do that now i want to know should i use ,
to do my stuff. because i thought about it and if i could only use both of them then i can't handle all my kernel functions so it would be impossible. thanks to anyone who will help me with this i just want a snippet or an example so i can learn from it and to solve my problem. :)
What I have tried:
i haven't tried anything yet. waiting for someone that may had this problem before and can help with it :)