Solved

Determine the PDH process names

Posted on 2008-06-16
5
806 Views
Last Modified: 2013-12-04
Hi,

I'm working on PDH (Performance Data Helper). The commands asks for the process name. The name is processed in a specific way such as adding index to the processes that have same names, remove the ".exe". However, I saw some instances whose names were truncated differently.
For example, the process "GoogleDesktopIndex.exe" is trunctated to "GoogleDesktopIndex", but the other process name such as "smtpmanualproc.exe" is truncated to "smtpmanualproc.ex".

The name length is not the determining factor in this case. I just wonder if there is any documentation about the PDH process name processing?

Thanks
0
Comment
Question by:mycuti08
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 21801869
When I browse the list, all of the items appear to match the expected naming.  Is there any chance that you are accidentally truncating the text yourself?
0
 

Author Comment

by:mycuti08
ID: 21802369
No, absoutely not. Because the process named "smtpmanualproc.exe" got truncated to "smtpmanualproc.ex", and sometimes I saw the truncated names as such "xxxxxx." without the "exe". It turned out the process names was "xxxxxx.exe" and got truncated by removing only "exe" not the dot. At first, I thought that there were a certain length below which the ".exe" was truncated and above it the full name was cut off to a certain length (no matter the extension, like the two examples mentioned above), but then I saw the very long name which was truncated the "standard way": ripped off the ".exe". That perplexed me, indeed.
0
 
LVL 86

Expert Comment

by:jkr
ID: 21803645
Try to list the processes the way the task manager does that. See http://msdn.microsoft.com/en-us/library/ms682623.aspx ("Enumerating All Processes") and the sample code it comes with:
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <psapi.h>
 
void PrintProcessNameAndID( DWORD processID )
{
    TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
 
    // Get a handle to the process.
 
    HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
                                   PROCESS_VM_READ,
                                   FALSE, processID );
 
    // Get the process name.
 
    if (NULL != hProcess )
    {
        HMODULE hMod;
        DWORD cbNeeded;
 
        if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), 
             &cbNeeded) )
        {
            GetModuleBaseName( hProcess, hMod, szProcessName, 
                               sizeof(szProcessName)/sizeof(TCHAR) );
        }
    }
 
    // Print the process name and identifier.
 
    _tprintf( TEXT("%s  (PID: %u)\n"), szProcessName, processID );
 
    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 and process identifier for each process.
 
    for ( i = 0; i < cProcesses; i++ )
        if( aProcesses[i] != 0 )
            PrintProcessNameAndID( aProcesses[i] );
}

Open in new window

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 21808015
I wonder about how you are determining that this truncation exists.  What method do you use to obtain the list in which the truncation occurs?

It occurs to me that the "friendly name" is actually the end result of a much longer name that includes the local computer, the directory path in which the image file resides, and so forth.   Perhaps that longer name hit some maximum and was truncated by the naming logic.  

Check out that possibility by tracking down the full path of the executable that ends up with one of these truncated names.  See if you can see a pattern (very long path name, computer name with and embedded apostrophe, etc.)
0
 

Accepted Solution

by:
mycuti08 earned 0 total points
ID: 21813555
It turns out that the WinXp and Win2000 have different naming conventions. Win2000 truncates the names which are longer than 15 characters. WinXP does not.
For example, "abcdefghisdfs.exe" will be truncated to "abcdefghisdfs.e" in Win2000.
Then the name being processed by removing ".exe". The truncated name does not have ".exe" therefore it still remains as "abcdefghisdfs.e" in Win2000, and as "abcdefghisdfs" in WinXP.

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Annoying "thing" blocks my view 4 146
wordmultiple challenge 12 170
Error building VS2105 solution from repository 1 62
Error in Visual Project 10 49
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

752 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