locked
Code Genration with UWP RRS feed

  • Question

  • If you look Package.appxmanifest/ Capabilities (for uwp) you will see Checkbox Code Generation which implies we may Generate code at RunTime. 

    So for the code I have seen to Generate are not for UWP, but works fine otherwise (for none UWP application). 

    It is not a real function but for example provided code in a string (Add 2 numbers) and compile at RunTime.

    string code ="int Add(int a, int b){return a + b;}";

     


    Agha Khan

    Friday, November 10, 2017 7:54 PM

Answers

  • The capability "codeGeneration" means you are allowed to create a virtual memory page and then set it's protection to PAGE_EXECUTE or PAGE_EXECUTE_READ via VirtualProtectFromApp. This is used by "Just In Time" compliers that create machine code on the fly that is then run. By default, all memory allocated by a UWP is locked down to disable execution except for the read-only pages of code that got loaded in the EXE or DLL--this is a key malware protection known as "NX".


    Saturday, November 11, 2017 5:45 AM