MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / protect_flags_from_memory_flags

Function protect_flags_from_memory_flags

lib/asmjit/asmjit/core/virtmem.cpp:191–207  ·  view source on GitHub ↗

Returns windows-specific protect_flags from \ref MemoryFlags.

Source from the content-addressed store, hash-verified

189
190// Returns windows-specific protect_flags from \ref MemoryFlags.
191static DWORD protect_flags_from_memory_flags(MemoryFlags memory_flags) noexcept {
192 DWORD protect_flags;
193
194 // READ|WRITE|EXECUTE.
195 if (Support::test(memory_flags, MemoryFlags::kAccessExecute)) {
196 protect_flags = Support::test(memory_flags, MemoryFlags::kAccessWrite) ? PAGE_EXECUTE_READWRITE : PAGE_EXECUTE_READ;
197 }
198 else if (Support::test(memory_flags, MemoryFlags::kAccessRW)) {
199 protect_flags = Support::test(memory_flags, MemoryFlags::kAccessWrite) ? PAGE_READWRITE : PAGE_READONLY;
200 }
201 else {
202 protect_flags = PAGE_NOACCESS;
203 }
204
205 // Any other flags to consider?
206 return protect_flags;
207}
208
209static DWORD desired_access_from_memory_flags(MemoryFlags memory_flags) noexcept {
210 DWORD access = Support::test(memory_flags, MemoryFlags::kAccessWrite) ? FILE_MAP_WRITE : FILE_MAP_READ;

Callers 2

allocFunction · 0.85
protectFunction · 0.85

Calls 1

testFunction · 0.85

Tested by

no test coverage detected