kernel mode :
<pre>VOID DriverLoop() {
while (TRUE)
{
ReadSharedMemory();
if (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Read") == 0)
{
DbgPrintEx(0, 0, "Read looping \n");
RtlZeroMemory(SharedSection, sizeof(SharedSection));
break;
}
else if (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Write") == 0)
{
DbgPrintEx(0, 0, "Write looping \n");
RtlZeroMemory(SharedSection, sizeof(SharedSection));
break;
}
LARGE_INTEGER Timeout;
Timeout.QuadPart = RELATIVE(SECONDS(1));
KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
}
}
user mode :
auto pBufW = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);
RtlCopyMemory(pBufW, "Read", 4);
printf("message has been sent to kernel! \n");
UnmapViewOfFile(pBufW);
Sleep(10);
auto pBfW = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);
RtlCopyMemory(pBfW, "Write", 5);
printf("message has been sent to kernel! \n");
UnmapViewOfFile(pBfW);
i can't figure it out why when i call Read and Write . only Write execute i have tried it multiple times and its always doing this + i have tried to add a sleep(1); in my user mode (thought it was executing real fast).
basically i just need them to execute normally like Read should be executed first then Write .
What I have tried:
i have tried to add a sleep of 1 and 10 seconds and it didn't work idk what i am doing wrong here.