The Program Files directory is designed to only allow Administrators to write to its contents. If you have Administrator permissions, you are already on the other side of the airtight hatchway and can execute your payload directly without having to resort to file replacement trickery.
That said, there are a few subtleties to this rule introduced by the Universal Windows Platform that I've observed:
- Packages can declare the
mutablePackageDirectories
mutable package directory extension which defines a writable directory that can be changed by users. These are indicated in Store listings with the "Enable the user to modify the app." designation so you can make an informed installation decision. - Original Equipment Manufacturers (OEMs) can place a
custom.data
OEM info file in themicrosoft.system.package.metadata
subfolder of your application package. The manufacturer has considerable influence on the security of your device, so you will need to trust them. - JavaScript applications generate a cached bytecode
JSByteCodeCache*
file in themicrosoft.system.package.metadata\Autogen
subfolder of your application package, which I've observed can happen at runtime. Presumably this is not a folder that will be searched for DLL loading, and the file contents are unlikely to be executable.