C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 3rd, 2009, 02:23 PM
latros latros is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 207 latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 6 h 52 sec
Reputation Power: 71
Typing "tasklist /m" in cmd window

Hello, when you type tasklist /m in the command window, it gives a list of all processes and the DLLs that are loaded for them.

I was wondering how they did this (WMI maybe?) and how I could potentially do the same thing programmatically.

Thank you

Reply With Quote
  #2  
Old November 3rd, 2009, 02:40 PM
jwdonahue's Avatar
jwdonahue jwdonahue is offline
Bellevue WA, USA
Click here for more information.
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 2,530 jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 11 h 58 m 20 sec
Reputation Power: 603
Yours is not a C/C++/C# question. You want a Windows SDK forum.

And yes, I am pretty sure that subsystem has a WMI interface. It's just not within the scope of this forum.
__________________
My worst nightmare was a pointless infinite loop.
Work in progress; don't poke the curmudgeon!
http://www.odonahue.com/

Reply With Quote
  #3  
Old November 3rd, 2009, 04:35 PM
latros latros is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 207 latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 6 h 52 sec
Reputation Power: 71
oh sorry. can you move it, or should I just create a new topic there?

Reply With Quote
  #4  
Old November 3rd, 2009, 04:50 PM
jwdonahue's Avatar
jwdonahue jwdonahue is offline
Bellevue WA, USA
Click here for more information.
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 2,530 jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 11 h 58 m 20 sec
Reputation Power: 603
You're going to have to create a new thread there. It's not part of Devshed.

Reply With Quote
  #5  
Old November 3rd, 2009, 05:18 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 8,354 Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 23rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 4 Days 17 h 44 m 34 sec
Reputation Power: 2549
Actually I think this is a very pertinent C or C++ question. He's asking how to do that programmatically. We do help with API calls here.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Fishmonger, superior perl programmer of the month

Reply With Quote
  #6  
Old November 3rd, 2009, 05:46 PM
jwdonahue's Avatar
jwdonahue jwdonahue is offline
Bellevue WA, USA
Click here for more information.
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 2,530 jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level)jwdonahue User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 11 h 58 m 20 sec
Reputation Power: 603
Quote:
Originally Posted by Scorpions4ever
Actually I think this is a very pertinent C or C++ question. He's asking how to do that programmatically. We do help with API calls here.


Oh? I thought we didn't go into non-standard library support here. You're the mod.

Reply With Quote
  #7  
Old November 4th, 2009, 09:26 AM
lucas69 lucas69 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 24 lucas69 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 4 h 19 m 43 sec
Reputation Power: 0
You can get the source (C) of Tasklist on Advanced Win32 group (http://tinyurl.com/yjy3ajr)

Reply With Quote
  #8  
Old November 4th, 2009, 10:13 AM
latros latros is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 207 latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 6 h 52 sec
Reputation Power: 71
Hi, sorry but tinyurl is blocked for me. Could you perhaps post the full link? Thanks!

Reply With Quote
  #9  
Old November 4th, 2009, 10:15 AM
IOI-RLZ's Avatar
IOI-RLZ IOI-RLZ is offline
BANDITS 6'0 Clock !
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Location: at the top of the stairway to heaven.
Posts: 698 IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 7098 Folding Title: Novice Folder
Time spent in forums: 2 Weeks 1 Day 22 h 39 m 33 sec
Reputation Power: 195
Send a message via MSN to IOI-RLZ Send a message via Yahoo to IOI-RLZ
Facebook
It sounds interesting and I think I will implement it once I get time ...

here.
__________________
The only Verdict is Vengeance a Vendetta held as a Votive, not in Vain, for the Value and Veracity of such shall one day Vindicate the Vigilant and the Virtuous


Mav RLZ AC/DC RLZ

Reply With Quote
  #10  
Old November 4th, 2009, 12:49 PM
latros latros is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 207 latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level)latros User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 6 h 52 sec
Reputation Power: 71
Thanks guys. That page is very helpful and it has a link to this page where MS gives a nice example of how to enumerate all modules for a process:
Code:
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <psapi.h>

void PrintModules( DWORD processID )
{
    HMODULE hMods[1024];
    HANDLE hProcess;
    DWORD cbNeeded;
    unsigned int i;

    // Print the process identifier.

    printf( "\nProcess ID: %u\n", processID );

    // Get a list of all the modules in this process.

    hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
                            PROCESS_VM_READ,
                            FALSE, processID );
    if (NULL == hProcess)
        return;

    if( EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded))
    {
        for ( i = 0; i < (cbNeeded / sizeof(HMODULE)); i++ )
        {
            TCHAR szModName[MAX_PATH];

            // Get the full path to the module's file.

            if ( GetModuleFileNameEx( hProcess, hMods[i], szModName,
                                      sizeof(szModName) / sizeof(TCHAR)))
            {
                // Print the module name and handle value.

                _tprintf( TEXT("\t%s (0x%08X)\n"), szModName, hMods[i] );
            }
        }
    }

    CloseHandle( hProcess );
}

void main( )
{
    // Get the list of process identifiers.

    DWORD aProcesses[1024], cbNeeded, cProcesses;
    unsigned int i;

    if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
        return;

    // Calculate how many process identifiers were returned.

    cProcesses = cbNeeded / sizeof(DWORD);

    // Print the name of the modules for each process.

    for ( i = 0; i < cProcesses; i++ )
        PrintModules( aProcesses[i] );
}
This is exactly what I was looking for, but I never would have found it b/c I was searching for the wrong terms. Thank you

Reply With Quote
  #11  
Old November 5th, 2009, 10:57 AM
IOI-RLZ's Avatar
IOI-RLZ IOI-RLZ is offline
BANDITS 6'0 Clock !
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Location: at the top of the stairway to heaven.
Posts: 698 IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 7098 Folding Title: Novice Folder
Time spent in forums: 2 Weeks 1 Day 22 h 39 m 33 sec
Reputation Power: 195
Send a message via MSN to IOI-RLZ Send a message via Yahoo to IOI-RLZ
Facebook
Quote:
Originally Posted by latros
I was searching for the wrong terms


The key is in the Keywords.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Typing "tasklist /m" in cmd window


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek