Link to home
Start Free TrialLog in
Avatar of GiedriusS
GiedriusS

asked on

Independent Process

Hi,

I am writing a windows service that uses nokia SDK com objects. I have a test program (simple exe file) that works fine, then I copy a function to my service and it crashes, I tried to execute exe file from my service then exe crashes, but it doesn't crash when I run it by simple clicking it. At first i thought it is a security bug, bet I configured my windows service to run not as LocalSystem account, but the same account I'm using, it didn't help. So I see only one solution it is to run my code (or exe) in a process that runs a different context not in that context that windows services run. I have to create a process that would be independent from my service and that would run in my account.

If you have any ideas please help me.
Anything will help!

Thanks in advance
Avatar of jkr
jkr
Flag of Germany image

What exactly do you mean by "it crashes"?
Avatar of GiedriusS
GiedriusS

ASKER

program (also the exe file) throws an exception that the phone is not connected, but it is connected I can send messages not from a service.
may be you use graphic interface in your service (windows services cant have user interfaces )
no, I dont use graphical interface.
I tried to do this:
my service executes exe file (is a console program), it writes me a message, a desitination number, then I press enter and my message has to go away. This file works fine when i double click it. i receive the message. But when service executes my exe file it writes message and desitination correctly, but when I press enter it throws an exception. The sendSMS method throws that exception, I have read some nokia SDK forums there were many other like me, who had the same problem with IIS and the same DLL, also with windows services, but no one replied with a suitable answer. I found out that the exception is not thrown on Windows 95, 98. So I think it's because it runs in a specific NT service environment.
I need to run my code in a process that computer would think that I am the one that executes it, not my NT service :)
I am trying to fix this bug almost for 3 weeks, and I got no results :(
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I haven't tried 'CreateProcessAsUser()' but will try it tomorrow, because I left my phone at work :)
CreateProcessAsUser() works fine, thanks jkr.