Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detection of service

0 views
Skip to first unread message

TofK

unread,
Jul 5, 2002, 7:02:49 AM7/5/02
to
Hello all,

I have some services to stop at the beginning of the installation and
to restart after...

There is no problem at the begining because if Service doesn't exist,
WI will pass without error.
But when he wan't to start a service which is not installed, a dialog
box appear...
Is there a way to detect if service is install on computer and, if
not, to not try to start the service ?

Thanks for your help (and example ;) ),
Christophe

MikeB...@lumenvox.com

unread,
Jul 5, 2002, 12:44:27 PM7/5/02
to
We ended up writing a CustomAction DLL for this problem. We used the Win32 API
function OpenSCManager() to get access to the service control manager and then
EnumServiceStatus() to gather information about all of the services. From there
you should be able to OpenService() to get its handle and then ControlService()
to stop it. To start the service again, you would call StartService().

Michael Bergman
Lumenvox LLC

In article <9536e142.02070...@posting.google.com>,
couc...@hotmail.com says...

Rich [Microsoft Windows Installer MVP]

unread,
Jul 7, 2002, 1:34:53 PM7/7/02
to
[Please do not mail me a copy of your followup]

couc...@hotmail.com (TofK) spake the secret code
<9536e142.02070...@posting.google.com> thusly:

>I have some services to stop at the beginning of the installation and
>to restart after...

What services? Are they services that you install?

>But when he wan't to start a service which is not installed, a dialog
>box appear...

Well... the obvious question is... why are you attempting to start a
service that is not installed?

>Is there a way to detect if service is install on computer and, if
>not, to not try to start the service ?

I would use AppSearch or a custom action to identify the presence of a
service and use that to set a property that conditionalizes the
StartServices action. If there are times when you need to change the
set of services that you start/stop and you can't disable the whole
StartServices action, then I would make a custom action that makes a
temporary modification to the database so that the StartServices
action starts only the necessary services.
--
Ask me about my upcoming book on Direct3D from Addison-Wesley!
Direct3D Book <http://www.xmission.com/~legalize/book/>
izfree: Open source tools for Windows Installer
<http://izfree.sourceforge.net>

TofK

unread,
Jul 8, 2002, 4:08:12 AM7/8/02
to
legaliz...@mail.xmission.com (Rich [Microsoft Windows Installer MVP]) wrote in message news:<ag9u3t$vf6$1...@terabinaries.xmission.com>...

> [Please do not mail me a copy of your followup]
>
> couc...@hotmail.com (TofK) spake the secret code
> <9536e142.02070...@posting.google.com> thusly:
>
> >I have some services to stop at the beginning of the installation and
> >to restart after...
>
> What services? Are they services that you install?

I don't know ! In reality, I make a exe which read in configuration
file in order to populate a MSI database. So I don't know what service
will be in this configuration file.

>
> >But when he wan't to start a service which is not installed, a dialog
> >box appear...
>
> Well... the obvious question is... why are you attempting to start a
> service that is not installed?

First answer : I don't know the service so I have to test this
possibity.


>
> >Is there a way to detect if service is install on computer and, if
> >not, to not try to start the service ?
>
> I would use AppSearch or a custom action to identify the presence of a
> service and use that to set a property that conditionalizes the
> StartServices action. If there are times when you need to change the
> set of services that you start/stop and you can't disable the whole
> StartServices action, then I would make a custom action that makes a
> temporary modification to the database so that the StartServices
> action starts only the necessary services.


Thanks, I will try that

Rich [Microsoft Windows Installer MVP]

unread,
Jul 8, 2002, 4:26:48 AM7/8/02
to
[Please do not mail me a copy of your followup]

couc...@hotmail.com (TofK) spake the secret code
<9536e142.02070...@posting.google.com> thusly:

>legaliz...@mail.xmission.com (Rich [Microsoft Windows Installer
>MVP]) wrote in message news:<ag9u3t$vf6$1...@terabinaries.xmission.com>...
>>
>> couc...@hotmail.com (TofK) spake the secret code
>> <9536e142.02070...@posting.google.com> thusly:
>>
>> >I have some services to stop at the beginning of the installation and
>> >to restart after...
>>
>> What services? Are they services that you install?
>
>I don't know ! In reality, I make a exe which read in configuration
>file in order to populate a MSI database. So I don't know what service
>will be in this configuration file.

Umm... you really need to identify the services that you are
attempting to control before you start mucking around with them. I
don't understand how you can know which services to start/stop when
the install is run, but you don't know what they are? If you don't
know what the services are or why you are stopping/starting them, you
need to take a step back and figure out just exactly -why- you are
even attempting to manipulate them in the first place. Either you are
confused about what you are attempting to do, or you haven't really
explained it in your posts.

0 new messages