Solved

Win32Exception: Unknown error (0xffffffff) when trying to run process.start()

Posted on 2010-11-18
6
3,842 Views
Last Modified: 2013-12-17
the following are lines I'm running in an application:
this code is running in a service. when the service is started using the  LSA (local system account) I get the following exception:
System.ComponentModel.Win32Exception: Unknown error (0xffffffff)
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at ePcontrol.FrmControlCommands.ControlTimer_Tick(Object sender, EventArgs e)
=================================
System.Collections.ListDictionaryInternal
=================================
Unknown error (0xffffffff)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

NO PROBLEM when running the service logged on using a user with domain admin credentials.
try

                        {

                            //Installing the service

                            ProcessStartInfo InstallService = new ProcessStartInfo(Application.StartupPath + "\\ePagntSv.exe", " -i");

                            InstallService.WindowStyle = ProcessWindowStyle.Hidden;

                            Process pInstallService = Process.Start(InstallService);

                            pInstallService.WaitForExit();

                            InstallService = null;

                        }

                        catch (Exception ex)

                        {

                            _DoneChecking = "Yes";



                            StreamWriter SaveEx = File.AppendText(Application.StartupPath + "\\ePcontrolEx.txt");

                            SaveEx.WriteLine(ex.GetBaseException());

                            SaveEx.WriteLine("=================================");

                            SaveEx.WriteLine(ex.Data);

                            SaveEx.WriteLine("=================================");

                            SaveEx.WriteLine(ex.Message);

                            SaveEx.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

                            SaveEx.Flush();

                            SaveEx.Close();

                        }

Open in new window

0
Comment
Question by:OrenRozen
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:ricovox
Comment Utility
Try adding the following lines BEFORE Process.Start

InstallService.CreateNoWindow = True;
InstallService.UseShellExecute = False;
0
 
LVL 4

Expert Comment

by:ricovox
Comment Utility
If that doesn't work, perhaps you can try to execute a different exe (such as calc.exe etc.) to see if this has to do with security restrictions on the exe you are trying to launch.
0
 
LVL 3

Author Comment

by:OrenRozen
Comment Utility
Thanks for the help.

I'll be able to check only after the weekend.

I'd also appreciate if you'll explain why you think the following lines should work/
InstallService.CreateNoWindow = True;
InstallService.UseShellExecute = False;

I think its something to do with credentials because when I set the service to log on using a user with domain admins credentials, the application is working with no problem.
Its something with the LSA credentials but I don't know where.

0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Expert Comment

by:ricovox
Comment Utility
I think that you are right about the credentials. And we might have more troubleshooting to do before this question is resolved.

The reason I suggested those two lines are the following:

//This makes sure that no UI is produced. Sometimes services that launch programs with a UI can cause errors if the service is not allowed to interact with the desktop. This is probably NOT that important, but is worth a try. However I believe launching the process as "Hidden" has the same effect.
InstallService.CreateNoWindow = True;


//This line causes the process to be started DIRECTLY from the exe you specify, instead of by using the shell. This will only matter if there are security restrictions against using the shell to launch files.
InstallService.UseShellExecute = False;

Like I said, it is possible that neither line will help. But we can at least safely and easily eliminate them as possible issues.

I think the more important test is trying to execute different exes to see if it is a permissions issue.
0
 
LVL 3

Accepted Solution

by:
OrenRozen earned 0 total points
Comment Utility
I did try these lines and it didn't solve the problem. what strange is that it is working on some servers but I get the problem on all other servers (this is a data-center of 450 servers).

any way, to solve the problem we've made a workaround because the customer got upset with this problem.
as this code is set to run on a remote server, what we did was to create and start the service from a management server to the remote server.
again, we didn't solve the problem but created a workaround. which I think is better to avoid the same issue at other customers.

I appreciate your help, but I don't have any way to continue and check this issue.
0
 
LVL 3

Author Closing Comment

by:OrenRozen
Comment Utility
no solution was provided.
a workaround was created
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now