VirtualAlloc2 and MapViewOfFile3 strange behaviour.

Stanislav 1 Reputation point
2022-05-30T08:49:23.573+00:00

Hi,
I need to implement fast ring buffer for my application.
I try to use the example from the MSDN page here: https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc2
Example of "Scenario 1. Create a circular buffer by mapping two adjacent views of the same shared memory section."

This example work perfectly fine when I run it under the debugger of Visual Studio (2022 & 2019).
But without the Visual Studio (at cmd) call to MapViewOfFile3 ends with the error 0x3e6 (998) - "Invalid access to memory location."

What is it and what to do?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,411 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Stanislav 1 Reputation point
    2022-05-30T13:10:27.627+00:00

    OK, I have ESET NOD32 and disabling it's HIPS "solves" this problem.
    Obviously for a production use it needs some workaround.

    0 comments No comments