Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
void sendrequests() {
auto Readstring = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

RtlCopyMemory(Readstring, "Read", 4);

printf("message has been sent to kernel [Read]! \n");


UnmapViewOfFile(Readstring) } ;


so basically if i do something like this

it works fine but if i add another mapviewoffile after that call it doesn't send anything to my driver , am mapping the section with zwmapviewofsection and looping until i find "Read" string then if it is found it will execute some code but problem is i can't send more than 1 request with mapviewoffile so i don't really know what is the problem with this issue. any help in advance is much appreciated.

What I have tried:

<pre lang="c++">void sendrequests() {
auto Readstring = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

RtlCopyMemory(Readstring, "Read", 4);

printf("message has been sent to kernel [Read]! \n");


UnmapViewOfFile(Readstring) 


auto Read_test = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

RtlCopyMemory(Read_test , "Test", 4);

printf("message has been sent to kernel [Read_test ]! \n");

UnmapViewOfFile(Read_test);

// but it doesn't work for some reason

} ;
Posted
Updated 21-Mar-19 13:43pm
v2
Comments
11917640 Member 24-Mar-19 2:01am    
Are you trying to use memory-mapped file just to send commands to the driver? Standard way to do this is DeviceIoControl.
Member 14130865 24-Mar-19 11:48am    
@11917640 Member yes and i have already solved it . using strlen to check my string size before sending it :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900