Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Apr : EnumServicesStatus doesn't seem to work

www.cryer.info
Managed Newsgroup Archive

EnumServicesStatus doesn't seem to work

Subject:EnumServicesStatus doesn't seem to work
Posted by:"Jon Springs" (jsprin..@jontanshe.org)
Date:Wed, 6 Apr 2005 16:18:51

I am trying to use the above mentioned function to list the services running
on my system.

I do the OpenSCManager to get a handle to the database and then execute this
code:

   if EnumServicesStatus( scmHandle, SERVICE_WIN32, SERVICE_ACTIVE,
                                       scmServices, SizeOf( scmServices ),
bytesNeeded,
                                       servicesReturned, resumeHandle ) then

The code compiles clean, but what I get back is:

bytesNeeded=5222
servicesReturned=0
resumeHandle=0
result= False
GetLastError=ERROR_MORE_DATA

The service names are nil in the scmServices structure.

If anyone has any suggestions, they would be most welcome.

Thanks,

-----Jon Springs-----

Replies:

www.cryer.info
Managed Newsgroup Archive