Solved

Independent Process

Posted on 2003-10-30
7
435 Views
Last Modified: 2010-04-01
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
0
Comment
Question by:GiedriusS
  • 4
  • 2
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 9650062
What exactly do you mean by "it crashes"?
0
 

Author Comment

by:GiedriusS
ID: 9650176
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.
0
 
LVL 11

Expert Comment

by:Agarici
ID: 9650197
may be you use graphic interface in your service (windows services cant have user interfaces )
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:GiedriusS
ID: 9650329
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 :(
0
 
LVL 86

Accepted Solution

by:
jkr earned 240 total points
ID: 9650353
>>I have to create a process that would be independent from my service and that would run in my account.

Have you tried spawning the process from your service using 'CreateProcessAsUser()'?
0
 

Author Comment

by:GiedriusS
ID: 9650465
I haven't tried 'CreateProcessAsUser()' but will try it tomorrow, because I left my phone at work :)
0
 

Author Comment

by:GiedriusS
ID: 9656751
CreateProcessAsUser() works fine, thanks jkr.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

747 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

12 Experts available now in Live!

Get 1:1 Help Now