Solved

service name

Posted on 2001-07-22
5
248 Views
Last Modified: 2010-04-06
Hi,
im installing a service and would like to call servicestart() straight after but cant see how without knowing the service name first to pass to it..
i have one solution but i wonder if anyone knows better way.
my solution was :

after installing i can get a list of services from the registry
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services
and search each subkey for the "ImagePath" item that contains the exe name and then if the imagepath contains the exe name i know the subkey is the name of the service

any other ideas?
0
Comment
Question by:inthe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6307146
EnumServicesStatus?
0
 
LVL 17

Author Comment

by:inthe
ID: 6307331
Hi,
EnumServicesStatus does just that ,
gets the status of a service ..i could do with a EnumServices() or a
GetServiceNameFromFile(filename:string);
 function :-)
0
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 100 total points
ID: 6307584
Hi inthe, :)

EnumServicesStatus enumerates through all services, returning an array of ENUM_SERVICE_STATUS

Just loop through the ENUM_SERVICE_STATUS structure, for the structure contains 3 fields, the ServiceName, DisplayName and the ServiceStatus.


DragonSlayer.
0
 
LVL 17

Author Comment

by:inthe
ID: 6309826
Hi,
ok so im blind and stupid ;-)
the example i had of EnumServicesStatus was not coded right that why it returned only one service,it was also looking for SERVICE_STOPPED instead of SERVICE_INACTIVE.
took a while to get it working correct but now its working,just need to add the compare code to test for service name.

ps,
sorry for delay ,i got confused when looking on newsgroups for examples as there were so many that do not work,or worse some do work but only return 30 or so services when it shouldve returned 60 like it is now.

thanks for showng right path to take anyways :-)

Regards Barry
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6310666
No probs... that's what ExpertsExchange is for, rite? To "open each others' eyes"  :)


DragonSlayer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 2 77
How to build JSON File in Delphi 6 3 69
firemonkey Android Listview Sort items 7 70
File Downloader in Multi threading , Measure Download Speed and progress 9 26
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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