Click here to Skip to main content
6,292,426 members and growing! (9,859 online)
Email Password   helpLost your password?
General Reading » Hardware & System » Services     Intermediate

Class for Enumerating NT Services

By Zoran M. Todorovic

A Class for enumerating NT services and drivers
VC6, Dev
Posted:7 Dec 1999
Views:35,223
Bookmarked:14 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
13 votes for this article.
Popularity: 5.04 Rating: 4.53 out of 5
1 vote, 20.0%
1

2

3

4
4 votes, 80.0%
5
  • Download demo executable - 12 Kb
  • Download source files - 3 Kb
  • 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
    
    }
    

    License

    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


    Member
    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.
    Occupation: Web Developer
    Company: SCA d.o.o.
    Location: Serbia Serbia

    Other popular Hardware & System articles:

    Article Top
    You must Sign In to use this message board.
    FAQ FAQ 
     
    Noise Tolerance  Layout  Per page   
     Msgs 1 to 2 of 2 (Total in Forum: 2) (Refresh)FirstPrevNext
    GeneralThank you! PinsussHarlan Seymour14:37 10 Feb '04  
    Generaldfsdfsd PinmemberAnonymous0:29 7 May '01  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    PermaLink | Privacy | Terms of Use
    Last Updated: 7 Dec 1999
    Editor: Chris Maunder
    Copyright 1999 by Zoran M. Todorovic
    Everything else Copyright © CodeProject, 1999-2009
    Web12 | Advertise on the Code Project