API for NT services

Posted on 1998-08-18
Last Modified: 2013-11-20

I'm writing a VC++ 5.0 application on NT 4.0
I need to get a list of all services on the NT system and all their attributes(running, stopped, automatic start, hardware profile settings, etc.)
Is there an API that gives me access to this information?
Does anyone have some source code you can point me at?

Question by:rakhras
  • 2

Accepted Solution

jdyer earned 50 total points
ID: 1320962
Use the GetService function with is part of the wsock32 library. Here is the declaration, if you need the definition, I will post a comment with it.

INT GetService(
    DWORD  dwNameSpace,      // specifies name space or spaces to search
    PGUID  lpGuid,      // points to GUID service type
    LPTSTR  lpServiceName,      // points to service name
    DWORD  dwProperties,      // specifies service information to be obtained
    LPVOID  lpBuffer,      // points to buffer to receive service information
    LPDWORD  lpdwBufferSize,      // points to size of buffer, size of service information
    LPSERVICE_ASYNC_INFO  lpServiceAsyncInfo       // reserved for future use, must be NULL


Expert Comment

ID: 1320963
Also checkout EnumServicesStatus!


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

Title # Comments Views Activity
Adapt this command to show who installed 29 106
Detect CR LF to each line 12 153
haveThree challenge 22 114
mapBully challenge 6 115
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

18 Experts available now in Live!

Get 1:1 Help Now