Click here to Skip to main content
13,597,244 members
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 7 Dec 1999

Class for Enumerating NT Services

, 7 Dec 1999
Rate this:
Please Sign up or sign in to vote.
A Class for enumerating NT services and drivers
  • Download demo executable - 12 Kb
  • Download source files - 3 Kb
  • <!-- Article Starts -->

    The purpose of this class is to enumerate NT services on a local machine. You can specify the following criteria for service enumeration:

    • Do you want to enumerate NT services or NT drivers.
    • Do you want to enumerate active or inactive services and or drivers.
    Since the criteria is a bit OR combination, you can specify none, one of criterias or all of them. In any case, you will receive a list of NT services that fullfil the specified criteria.

    The class is designed to work with STL classes. In fact, there are 2 EnumServices functions. One that returns a pointer to a list of objects (in this case caller is responsible to delete this pointer using delete []) and another that returns an STL list containing service objects.

    Sample using STL list

    TNtServiceInfoList srvList;
    TNtServiceInfo::EnumServices(SERVICE_WIN32, SERVICE_ACTIVE, &srvList);
    TNtServiceInfoList::iterator it;
    for (it = srvList.begin(); it != srvList.end(); it ++) 
       TNtServiceInfo *pInfo = &(*it);
       // Do something


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Zoran M. Todorovic
    Web Developer SCA d.o.o.
    Serbia Serbia
    I am a cofounder of SCA Software, company that specializes in software for process control, visualization and communication. Programming for the last 10 years in C++, Delphi. Visual C++ for the last 6 years. Degree in Electronics Engineering and Telecommunications.

    You may also be interested in...


    Comments and Discussions

    GeneralWorks like a charm! Pin
    pubis16-Jul-11 10:28
    memberpubis16-Jul-11 10:28 
    GeneralMy vote of 5 Pin
    pubis16-Jul-11 10:26
    memberpubis16-Jul-11 10:26 
    GeneralThank you! Pin
    Harlan Seymour10-Feb-04 13:37
    sussHarlan Seymour10-Feb-04 13:37 
    Generaldfsdfsd Pin
    Anonymous6-May-01 23:29
    memberAnonymous6-May-01 23:29 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
    Web01-2016 | 2.8.180621.3 | Last Updated 8 Dec 1999
    Article Copyright 1999 by Zoran M. Todorovic
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid