Error C0000142 when Starting a Process

12,493

I was able to get it working using CreateProcessAsUser from here and adding LoadUserProfile from here.

Without LoadUserProfile a lot of tools will not work and give you strange errors because they need a home directory (e.g. svn.exe and mstest.exe).

Share:
12,493
laktak
Author by

laktak

My backslash escaped!

Updated on June 04, 2022

Comments

  • laktak
    laktak almost 2 years

    I am trying to start a process under a different account (setting StartInfo.UserName/Password).

    This works when run interactive but fails with error -1073741502 (C0000142; "DLL Initialization Failed") when trying to run it from a process that was started via the Task Scheduler.

    I've tried to switch to the WIN32 API and to create a new WindowStation with STARTUPINFO.lpDesktop="" but I get the same error.

    Update: I just found a related question, unfortunately it is also missing an answer: Permissions problem when starting .NET app from .NET service as a different user?