Windows 2008: application crashes when __COMPAT_LAYER=ElevateCreateProcess

1.4k views Asked by At

There is application that can be started properly by Windows 2008, lets call it App1.

When the same application is started by another application (Launcher), App1 crashes in secur32.dll. Research indicated environment in those 2 cases was different.

When application crashes, it's environment has one extra variable __COMPAT_LAYER=ElevateCreateProcess.

Setting __COMPAT_LAYER=asInvoker on a global system level didn't resolve the issue. Adding App1 and Launcher to registry at HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers also doesn't resolve it.

Both programs have the following permission in their manifests: requestedExecutionLevel level="asInvoker" uiAccess="false"

UAC is turned off. Windows updates are up to date. The only solution that helps is injecting another program in between that clears the __COMPAT_LAYER or sets it to asInvoker.

What can possibly be the cause of ElevateCreateProcess and how to avoid it? Thank you.

2

There are 2 answers

0
vt. On BEST ANSWER

As it turns out the issue was prompted by calling GetUserName during dll init which crashes on Vista. Related post is https://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/ae1b1e4ecbb6b123/1e9fefd4c8b12452

0
tstadel On

The cause of this behavior might be the naming of your Launcher process. Windows augments every process matching the naming pattern "*launch*.exe" with the ElevateCreateProcess Flag. This awkward behavior is specified in the windows\apppatch\sysmain.sdb shim database. You can view this by installing and running the application compatibility Toolkit. Under "System Database (32-bit)/Applications/Autorun" you can find this entry. Although disabling might be risky as well, rightclick -> Disable Entry does not work in my case either.