Firdosh

Hi,

I have a simple windows which is supposed to spawn a new process using the credentials of a different domain user.

The service is running using the domain admin credentials.

But for some reason when I try to run a new process using the credentials of a different user the application just crashes with the following error:

---------------------------
deployEnv.exe - Application Error
---------------------------
The application failed to initialize properly (0xc0000142). Click on OK to terminate the application.
---------------------------
OK
---------------------------

Here is the snippet of the windows service code that invokes the application.

if (myDeploymentObj.SetupFile.UserName != string.Empty && myDeploymentObj.SetupFile.DomainName != string.Empty)

{

process.StartInfo.Domain = myDeploymentObj.SetupFile.DomainName;

process.StartInfo.UserName = myDeploymentObj.SetupFile.UserName;

process.StartInfo.Password = new System.Security.SecureString();

foreach (char ch in myDeploymentObj.SetupFile.Password)

{

process.StartInfo.Password.AppendChar(ch);

}

}

process.StartInfo.WorkingDirectory = Path.GetDirectoryName(setupFilePath);

process.StartInfo.UseShellExecute = false;

process.StartInfo.LoadUserProfile = true;

process.StartInfo.FileName = myDeploymentObj.SetupFile.FilePath;

try

{

process.Start();

process.WaitForExit();

}

catch (Exception ex)

{

this.EventLog.WriteEntry(ex.Message, EventLogEntryType.Error);

}

The porpose of the service is to deploy and start my test automation -- There is no UI needed for the automation. I need to have the automation run under the credentials of different domain users.

Thanks,

Firdosh



Re: Visual C# General Start a new process using a windows service

Peter Ritchie

Because you're trying to run your application from a service, you're running with a non-interactive desktop heap. This heap is much smaller than than the interactive heap and probably isn't large enough to run the service and your application. See KB824422 (the example used is SQL Server; but it would apply to any service) on how to correct this.




Re: Visual C# General Start a new process using a windows service

Firdosh

No that didnt help either. I changed the value from 512 to 3072 but got the same error. Is there any security issue around this. because when i spawn the process using the domain admin credentials the process launches successfully.But the minute I give the credentials of a different user I get this error.

Thanks,

Firdosh