Click here to Skip to main content
15,891,136 members
Articles / Desktop Programming / MFC

Process viewer

Rate me:
Please Sign up or sign in to vote.
4.94/5 (104 votes)
9 Mar 2008CPOL9 min read 456.5K   22K   294  
Lists out the details of running processes in a system, loaded drivers, loaded dlls, version of each dll and process, process times, command line, owner, priority, GDI resource usage, privileges, loaded symbols, window heirarchy, autostart app finding and more.
#ifndef _AUTO_START_UP_INFO_H_
#define _AUTO_START_UP_INFO_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "TypedefsInclude.h"

class CAutoStartupInfo  
{
    public:

	    CAutoStartupInfo();
	    virtual ~CAutoStartupInfo();
        bool Load();
        bool Lookup( LPCTSTR lpctszExeName_i ) const;
        void AddAutoStartExePath( const CString& csAutoStartExePath_i )
        {
            m_AutoStartups.push_back( csAutoStartExePath_i );
        }

    private:

        // Registry helper functions
        HKEY GetRegKey( const HKEY hKey, LPCTSTR lpctszSubKey ) const;
        bool GetAutoStartupApplicationPaths( const HKEY hKey_i );
        bool IsShortPathName( LPCTSTR lpctszPath_i ) const
        {
            return lpctszPath_i && _tcschr( lpctszPath_i, _T( '~' ));
        }
        bool IsEnvironmentVarPath( LPCTSTR lpctszPath_i ) const
        {
            return lpctszPath_i && _tcschr( lpctszPath_i, _T( '%' ));
        }

        // Get's string value of a key's value from registry
        bool GetRegKeyStringValue( const HKEY hKey_i, LPCTSTR lpctszSubKeyName_i, CString& csValue_o ) const;

        // Reads in users profile directory
        bool GetUserProfileDir( CString& csUserProfileDir_o,
                                CString& csAllUserProfileDir_o ) const;
        bool GetStartupFolderPath( CString& csStartupFolderPath_o,
                                   CString& csAllUsersStartupFolderPath_o ) const;

        bool FindExeFromPath( CString csPath_i );
        bool ReadInAutoStartAppsFromStartupFolder();

    private: // Member vars

        StringVector m_AutoStartups;

        HKEY m_hLocalMachineAutostartupKey;
        HKEY m_hCurrentUserAutostartupKey;
};

#endif // _AUTO_START_UP_INFO_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Microsoft
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions