This post originally appeared on my now deprecated ME3Tweaks Blog that was hosted on Blogger. It’s been ported here for consistency. This post was published originally on January 30, 2018 and has only been slightly modified to make it easier to read here. The contents remain unchanged.

———————

Hi all. It’s been some time since I’ve posted. No I am not dead. I have been doing a lot of work behind the scenes. Been working on my own ME3Explorer fork which has many quality of life improvements and even some new tools. I’ve also been working on Mod Manager 5.1 which has some slick new importing of third party mods, but it’s been on the back burner since I’ve been working on the new ALOT Installer front end.

ALOT Installer 2017
ALOT Installer using the 2017 manifest

I have been working with CreeperLava and Aquadran to implement this, which should make life way easier for end users installing ALOT and its Addon (textures by others). One issue I have had is that Origin will not launch the game once ALOT is installed unless run as admin. And since you cannot have origin startup as admin on boot it is really annoying. This also affects MEUITM. So I looked into figuring out why. It’s actually a perfect storm of security, bad coding, and people trying to make others lives easier.

Lets break down how Mass Effect works with Origin in a non-modified state, on Windows 10.

  • You run MassEffect.exe. It immediately asks for elevation to administrator.
  • At the end of the MassEffect.exe image there is code to call Origin to run the game, as a form of DRM. It calls origin, and then exits.
  • Origin checks your entitlement to the game and will then run MassEffect.exe as specified by the registry (not the one you booted specifically) and attempts to run the executable.
  • Origin is unable to run the executable because it requires elevation. In order for the DRM to work it must be able to interface with the process, so it elevates one of its internal services so it can communicate with the game for DRM purposes.
  • MassEffect.exe is run as administrator. Origin communicates with MassEffect.exe and game execution continues like it does from the DVD version.

Now, this all works (though two UAC prompts) on an unmodified game. But install MEUITM or ALOT and you won’t be able to run the game anymore through Origin as a standard user. What gives?

File signatures

Both MEUITM and ALOT modify the MassEffect.exe executable to use Large Address Aware. This allows the 32-bit Mass Effect process to use up to 4GB of ram instead of the usual 32-bit limit of 2GB. By modifying the LAA flag, the digital signature on MassEffect.exe is broken – the signature is used to verify the file is not modified. Once the file is modified, the signature is no longer valid.

Origin, when running an elevated process, checks to see if the EXE is signed by EA and is valid. If it is not signed by EA, it doesn’t elevate its DRM communication module. Mass Effect boots up, and then immediately closes as the DRM unlock doesn’t work because there is nothing to talk to it from Origin’s side as it refused to elevate.

So by modifying the EXE, origin will refuse to run an elevated game executable. But we need LAA, so we must work around this issue. Our only hope is to prevent MassEffect.exe from running as an administrator. We should figure out how it is set to run as administrator first.

Looking in the EXE’s manifest I can see it runs as the invoker – the user who is running the EXE. Which means this executable should not require administrator. I check my compatibility settings, nothing there either. Somehow, this is being elevated at boot but not through the exe itself nor my own doing. The culprit? The Microsoft Windows Compatibility Database.

mirh (I’ve seen him in some of the modding circles) did some sleuthing to figure out why Mass Effect is being forced to run as administrator. It meets the criteria in the database – it specifically has an entry for Mass Effect – which has its own always-forced compatibility settings. It makes sense – users shouldn’t have to configure the settings if MS already knows ones that (technically) work.

As you can see there are two entries for this game – MassEffect.exe (the game) and the launcher (which is not included in origin’s version sadly). The compatibility fix is RunAsHighest – which means administrator – and the criteria are:

  • EXE is named MassEffect.exe
  • Company name in manifest is BioWare
  • Product name in manifest is Mass Effect
  • Product version is equal to or less than 1.2.0.0.

This criteria matches all known versions of the game – I believe including pirated versions. So by matching all of these criteria, the exe is forced to run as an administrator. You can test this out easily by simply renaming MassEffect.exe to anything else and it will no longer require admin to run. (Origin won’t be happy).

The fix

So now we have an idea of how to fix this – but why is this entry here? Well, due to Demiurge/Bioware not following the idea of Least User Access (LUA), Mass Effect on its very first boot requires administrative privilege to write to the HKEY_LOCAL_MACHINE\SOFTWARE\AGEIA Technologies registry key. If this key does not exist, it will attempt to make it – without admin, it doesn’t have permission to, and the game simply crashes. This key seems to hold some sort of information about what is now known as PhysX. This could possibly have been done by the installer, but it seems they made it be done in the game instead.

This is why Microsoft forces the game to run as admin always – for this one single item. It makes sense – make it run as admin, user does not need to worry about compatibility settings. However due to this combo of all three – LAA breaking the signature, MS forcing it to run as admin, and Origin refusing to work with elevated processes that have a broken EA signature – Mass Effect does not run with Origin and LAA.

So what did we do to fix it? We simply modify in the EXE the product name from Mass Effect to Mass_Effect. Really, that’s it. It fails the criteria check and the game no longer needs admin and Origin is happy (except for that update nagging it always does). In both MEUITM and ALOT Installer we added code to make it create this registry key with write privileges for the current user, so if Mass Effect needs to make the keys (maybe its never been run somehow) it will be happy.

1 thought on “Why Mass Effect requires administrator rights – and how we fixed Origin not running it

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>