MCPcopy Create free account
hub / github.com/Inori/GPCS4 / GetProtectFlag

Function GetProtectFlag

GPCS4/Platform/PlatMemory.cpp:17–45  ·  view source on GitHub ↗

GPCS4 flag to Windows flag

Source from the content-addressed store, hash-verified

15
16// GPCS4 flag to Windows flag
17inline uint32_t GetProtectFlag(VM_PROTECT_FLAG nOldFlag)
18{
19 uint32_t nNewFlag = 0;
20 do
21 {
22 if (nOldFlag & VMPF_NOACCESS)
23 {
24 nNewFlag = PAGE_NOACCESS;
25 break;
26 }
27
28 if (nOldFlag & VMPF_CPU_READ)
29 {
30 nNewFlag = PAGE_READONLY;
31 }
32
33 if (nOldFlag & VMPF_CPU_WRITE)
34 {
35 nNewFlag = PAGE_READWRITE;
36 }
37
38 if (nOldFlag & VMPF_CPU_EXEC)
39 {
40 nNewFlag = PAGE_EXECUTE_READWRITE;
41 }
42
43 } while (false);
44 return nNewFlag;
45}
46
47// Windows flag to GPCS4 flag
48inline VM_PROTECT_FLAG RecoverProtectFlag(uint32_t nOldFlag)

Callers 3

VMAllocateFunction · 0.85
VMAllocateAlignFunction · 0.85
VMProtectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected