winapiwindows-server-2008process-elevation

Windows 2008: application crashes when __COMPAT_LAYER=ElevateCreateProcess


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.


Solution

  • 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