File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,10 +68,24 @@ static void more_core(void)
6868
6969 /* allocate a memory block */
7070#ifdef MS_WIN32
71+ #ifdef MS_WINDOWS_DESKTOP
7172 item = (ITEM * )VirtualAlloc (NULL ,
7273 count * sizeof (ITEM ),
7374 MEM_COMMIT ,
7475 PAGE_EXECUTE_READWRITE );
76+ #else // UWP
77+ /* Due security restrictions, UWP not allows request Read-Write-Execute permissions at once.
78+ The correct flow in UWP for execute dynamic code in memmory is:
79+ 1. Alloate as Read-Write (PAGE_READWRITE) and write dynamic code to memmory.
80+ 2. Change to Executable (PAGE_EXECUTE_READ) with 'VirtualProtectFromApp'.
81+ 3. Flush cache with 'FlushInstructionCache' to ensure CPU instruction cache coherency
82+ before executing the generated code.
83+ !@todo implement points 2. 3. in the appropriate places */
84+ item = (ITEM * )VirtualAllocFromApp (NULL ,
85+ count * sizeof (ITEM ),
86+ MEM_COMMIT | MEM_RESERVE ,
87+ PAGE_READWRITE );
88+ #endif // !MS_WINDOWS_DESKTOP
7589 if (item == NULL )
7690 return ;
7791#else
You can’t perform that action at this time.
0 commit comments