Solved

get services files

Posted on 2010-09-15
5
361 Views
Last Modified: 2012-05-10
http://www.delphitricks.com/source-code/systeminfo/get_a_list_of_installed_services.html
that link pointed a list of services, i'd like to list there files also.
please
0
Comment
Question by:systan
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:dr-evil
ID: 33688377
what is your problem?
u can't use code?
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 33688441
Use this function and pass in the service manage handle and the service name
ServiceFileName := GetServiceInformation(schm, StrPas(ssa^[j].lpServiceName))

function GetServiceInformation(const SCHandle: THandle; const AServiceName: string): string;
var
  ServiceHandle, StartType: THandle;
  Config: PQueryServiceConfig;
  Bytes_Needed: DWord;
begin
  Result := '';
  try
    ServiceHandle := OpenService(SCHandle,  PChar(AServiceName), SERVICE_QUERY_CONFIG);
    if ServiceHandle > 0 then
      try
        QueryServiceConfig(ServiceHandle, nil, 0, bytes_needed);
        GetMem(config, bytes_needed);
        try
          Win32Check(QueryServiceConfig(ServiceHandle, config, bytes_needed, bytes_needed));
          StartType := config.dwStartType;
          Result := config.lpBinaryPathName;
        finally
          FreeMem(config);
        end;
      finally
        CloseServiceHandle(ServiceHandle);
      end;
  except
  end;
end;
0
 
LVL 14

Author Closing Comment

by:systan
ID: 33688629
ewangoya;
Yes, its doned.

But, I want to ask,   why you know such like this kind of code?  do you have any reference that i could also see and understand more clearer?

Your not a magician I know, thats why I ask how did you know that?  Where did you get the code solution?  Is it because of your years of experience in codes like this?

How did you arrive in this area?

Because me?, I'm really having a hardtime programming with delphi,  but not vb.net and c#.NET.

lol, I'm sorry, but I already accepted your solution, its up to you to reply back or not.

Thanks
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 33697560
I suppose its just from a couple of years of experience I've had with Delphi.
I've come across lots of code on different projects. If you need refence for windows API, take a look at http://msdn.microsoft.com/en-us/library/
The codes are in C so you have to convert to equivalent delphi
0
 
LVL 14

Author Comment

by:systan
ID: 33698128
ah, ok, i see, so 1 man well experienced is better than any number of men when it comes programming.
I think you must have a masters rank also, you should grad it.

Thanks, seeya.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

932 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

20 Experts available now in Live!

Get 1:1 Help Now