Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core.win32/library/listtasks')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp36
-rw-r--r--core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h58
-rw-r--r--core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp692
-rw-r--r--core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp234
-rw-r--r--core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw58
-rw-r--r--core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h42
6 files changed, 560 insertions, 560 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp
index ace4d4df66d..f231562921e 100644
--- a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp
+++ b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2002 - 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-// stdafx.cpp : source file that includes just the standard includes
-// ProcList.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
+/*******************************************************************************
+ * Copyright (c) 2002 - 2005 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ *******************************************************************************/
+// stdafx.cpp : source file that includes just the standard includes
+// ProcList.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h
index 3eebdec8144..f51c2a6b60d 100644
--- a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h
+++ b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2002 - 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#if !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_)
-#define AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-
-// TODO: reference additional headers your program requires here
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_)
+/*******************************************************************************
+ * Copyright (c) 2002 - 2005 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ *******************************************************************************/
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_)
+#define AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_)
diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp
index c6a626c26d7..bdfc126abb1 100644
--- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp
+++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp
@@ -1,346 +1,346 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2011 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-// ProcList.cpp : Defines the entry point for the console application.
-//
-
-#include "stdafx.h"
-
-#include "listtasks.h"
-#include <tlhelp32.h>
-#include <vdmdbg.h>
-#include <iostream>
-#include <iomanip>
-
-using namespace std;
-
-typedef struct
-{
- DWORD dwPID ;
- PROCENUMPROC lpProc ;
- DWORD lParam ;
- BOOL bEnd ;
-} EnumInfoStruct ;
-
-BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16,
- PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined ) ;
-
-BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM ) ;
-
-int main(int argc, char* argv[])
-{
- EnumProcs(OutProcInfo, 0);
- return 0;
-}
-
-
-
-/*********************
-EnumProc.cpp
-*********************/
-
-// The EnumProcs function takes a pointer to a callback function
-// that will be called once per process in the system providing
-// process EXE filename and process ID.
-// Callback function definition:
-// BOOL CALLBACK Proc( DWORD dw, LPCSTR lpstr, LPARAM lParam ) ;
-//
-// lpProc -- Address of callback routine.
-//
-// lParam -- A user-defined LPARAM value to be passed to
-// the callback routine.
-BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam )
-{
- OSVERSIONINFO osver ;
- HINSTANCE hInstLib ;
- HINSTANCE hInstLib2 ;
- HANDLE hSnapShot ;
- PROCESSENTRY32 procentry ;
- BOOL bFlag ;
- LPDWORD lpdwPIDs ;
- DWORD dwSize, dwSize2, dwIndex ;
- HMODULE hMod ;
- HANDLE hProcess ;
- char szFileName[ MAX_PATH ] ;
- EnumInfoStruct sInfo ;
-
- // ToolHelp Function Pointers.
- HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
- BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
- BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
-
- // PSAPI Function Pointers.
- BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * );
- BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *,
- DWORD, LPDWORD );
- DWORD (WINAPI *lpfGetModuleFileNameEx)( HANDLE, HMODULE,
- LPTSTR, DWORD );
-
- // VDMDBG Function Pointers.
- INT (WINAPI *lpfVDMEnumTaskWOWEx)( DWORD,
- TASKENUMPROCEX fp, LPARAM );
-
-
- // Check to see if were running under Windows95 or
- // Windows NT.
- osver.dwOSVersionInfoSize = sizeof( osver ) ;
- if( !GetVersionEx( &osver ) )
- {
- return FALSE ;
- }
-
- // If Windows NT:
- if( osver.dwPlatformId == VER_PLATFORM_WIN32_NT )
- {
-
- // Load library and get the procedures explicitly. We do
- // this so that we don't have to worry about modules using
- // this code failing to load under Windows 95, because
- // it can't resolve references to the PSAPI.DLL.
- hInstLib = LoadLibraryA( "PSAPI.DLL" ) ;
- if( hInstLib == NULL )
- return FALSE ;
-
- SYSTEM_INFO systemInfo;
-
- GetSystemInfo(&systemInfo);
- bool isWin64 = systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
-
- if(!isWin64)
- {
- hInstLib2 = LoadLibraryA( "VDMDBG.DLL" ) ;
- if( hInstLib2 == NULL )
- return FALSE ;
- }
-
- // Get procedure addresses.
- lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))
- GetProcAddress( hInstLib, "EnumProcesses" ) ;
- lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
- DWORD, LPDWORD)) GetProcAddress( hInstLib,
- "EnumProcessModules" ) ;
- lpfGetModuleFileNameEx =(DWORD (WINAPI *)(HANDLE, HMODULE,
- LPTSTR, DWORD )) GetProcAddress( hInstLib,
- "GetModuleFileNameExA" ) ;
- if(!isWin64)
- {
- lpfVDMEnumTaskWOWEx =(INT(WINAPI *)( DWORD, TASKENUMPROCEX,
- LPARAM))GetProcAddress( hInstLib2, "VDMEnumTaskWOWEx" );
- }
- if( lpfEnumProcesses == NULL ||
- lpfEnumProcessModules == NULL ||
- lpfGetModuleFileNameEx == NULL ||
- (!isWin64 && lpfVDMEnumTaskWOWEx == NULL))
- {
- FreeLibrary( hInstLib ) ;
- if(!isWin64)
- {
- FreeLibrary( hInstLib2 ) ;
- }
- return FALSE ;
- }
-
- // Call the PSAPI function EnumProcesses to get all of the
- // ProcID's currently in the system.
- // NOTE: In the documentation, the third parameter of
- // EnumProcesses is named cbNeeded, which implies that you
- // can call the function once to find out how much space to
- // allocate for a buffer and again to fill the buffer.
- // This is not the case. The cbNeeded parameter returns
- // the number of PIDs returned, so if your buffer size is
- // zero cbNeeded returns zero.
- // NOTE: The "HeapAlloc" loop here ensures that we
- // actually allocate a buffer large enough for all the
- // PIDs in the system.
- dwSize2 = 256 * sizeof( DWORD ) ;
- lpdwPIDs = NULL ;
- do
- {
- if( lpdwPIDs )
- {
- HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ;
- dwSize2 *= 2 ;
- }
- lpdwPIDs = (LPDWORD)HeapAlloc( GetProcessHeap(), 0, dwSize2 );
- if( lpdwPIDs == NULL )
- {
- FreeLibrary( hInstLib ) ;
- if(!isWin64)
- {
- FreeLibrary( hInstLib2 ) ;
- }
- return FALSE ;
- }
- if( !lpfEnumProcesses( lpdwPIDs, dwSize2, &dwSize ) )
- {
- HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ;
- FreeLibrary( hInstLib ) ;
- if(!isWin64)
- {
- FreeLibrary( hInstLib2 ) ;
- }
- return FALSE ;
- }
- }while( dwSize == dwSize2 ) ;
-
- // How many ProcID's did we get?
- dwSize /= sizeof( DWORD ) ;
-
- // Loop through each ProcID.
- for( dwIndex = 0 ; dwIndex < dwSize ; dwIndex++ )
- {
- szFileName[0] = 0 ;
- // Open the process (if we can... security does not
- // permit every process in the system).
- hProcess = OpenProcess(
- PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
- FALSE, lpdwPIDs[ dwIndex ] ) ;
- if( hProcess != NULL )
- {
- // Here we call EnumProcessModules to get only the
- // first module in the process this is important,
- // because this will be the .EXE module for which we
- // will retrieve the full path name in a second.
- if( lpfEnumProcessModules( hProcess, &hMod,
- sizeof( hMod ), &dwSize2 ) )
- {
- // Get Full pathname:
- if( !lpfGetModuleFileNameEx( hProcess, hMod,
- szFileName, sizeof( szFileName ) ) )
- {
- szFileName[0] = 0 ;
- }
- }
- CloseHandle( hProcess ) ;
- }
- // Regardless of OpenProcess success or failure, we
- // still call the enum func with the ProcID.
- if(!lpProc( lpdwPIDs[dwIndex], 0, szFileName, lParam))
- break ;
-
- // Did we just bump into an NTVDM?
- if(!isWin64 && _stricmp( szFileName+(strlen(szFileName)-9),
- "NTVDM.EXE")==0)
- {
- // Fill in some info for the 16-bit enum proc.
- sInfo.dwPID = lpdwPIDs[dwIndex] ;
- sInfo.lpProc = lpProc ;
- sInfo.lParam = lParam ;
- sInfo.bEnd = FALSE ;
- // Enum the 16-bit stuff.
- lpfVDMEnumTaskWOWEx( lpdwPIDs[dwIndex],
- (TASKENUMPROCEX) Enum16,
- (LPARAM) &sInfo);
-
- // Did our main enum func say quit?
- if(sInfo.bEnd)
- break ;
- }
- }
-
- HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ;
- if(!isWin64)
- {
- FreeLibrary( hInstLib2 ) ;
- }
-
- // If Windows 95:
- }else if( osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
- {
-
-
- hInstLib = LoadLibraryA( "Kernel32.DLL" ) ;
- if( hInstLib == NULL )
- return FALSE ;
-
- // Get procedure addresses.
- // We are linking to these functions of Kernel32
- // explicitly, because otherwise a module using
- // this code would fail to load under Windows NT,
- // which does not have the Toolhelp32
- // functions in the Kernel 32.
- lpfCreateToolhelp32Snapshot=
- (HANDLE(WINAPI *)(DWORD,DWORD))
- GetProcAddress( hInstLib,
- "CreateToolhelp32Snapshot" ) ;
- lpfProcess32First=
- (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
- GetProcAddress( hInstLib, "Process32First" ) ;
- lpfProcess32Next=
- (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
- GetProcAddress( hInstLib, "Process32Next" ) ;
- if( lpfProcess32Next == NULL ||
- lpfProcess32First == NULL ||
- lpfCreateToolhelp32Snapshot == NULL )
- {
- FreeLibrary( hInstLib ) ;
- return FALSE ;
- }
-
- // Get a handle to a Toolhelp snapshot of the systems
- // processes.
- hSnapShot = lpfCreateToolhelp32Snapshot(
- TH32CS_SNAPPROCESS, 0 ) ;
- if( hSnapShot == INVALID_HANDLE_VALUE )
- {
- FreeLibrary( hInstLib ) ;
- return FALSE ;
- }
-
- // Get the first process' information.
- procentry.dwSize = sizeof(PROCESSENTRY32) ;
- bFlag = lpfProcess32First( hSnapShot, &procentry ) ;
-
- // While there are processes, keep looping.
- while( bFlag )
- {
- // Call the enum func with the filename and ProcID.
- if(lpProc( procentry.th32ProcessID, 0,
- procentry.szExeFile, lParam ))
- {
- procentry.dwSize = sizeof(PROCESSENTRY32) ;
- bFlag = lpfProcess32Next( hSnapShot, &procentry );
- }else
- bFlag = FALSE ;
- }
-
-
- }else
- return FALSE ;
-
- // Free the library.
- FreeLibrary( hInstLib ) ;
-
- return TRUE ;
-}
-
-BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16,
- PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined )
-{
- BOOL bRet ;
-
- EnumInfoStruct *psInfo = (EnumInfoStruct *)lpUserDefined ;
-
- bRet = psInfo->lpProc( psInfo->dwPID, hTask16, pszFileName,
- psInfo->lParam ) ;
-
- if(!bRet)
- {
- psInfo->bEnd = TRUE ;
- }
-
- return !bRet;
-}
-
-BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM )
-{
- cout << setw(10) << pid << '\t' << procName << '\n';
- return TRUE;
-}
+/*******************************************************************************
+ * Copyright (c) 2002, 2011 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ *******************************************************************************/
+// ProcList.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+#include "listtasks.h"
+#include <tlhelp32.h>
+#include <vdmdbg.h>
+#include <iostream>
+#include <iomanip>
+
+using namespace std;
+
+typedef struct
+{
+ DWORD dwPID ;
+ PROCENUMPROC lpProc ;
+ DWORD lParam ;
+ BOOL bEnd ;
+} EnumInfoStruct ;
+
+BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16,
+ PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined ) ;
+
+BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM ) ;
+
+int main(int argc, char* argv[])
+{
+ EnumProcs(OutProcInfo, 0);
+ return 0;
+}
+
+
+
+/*********************
+EnumProc.cpp
+*********************/
+
+// The EnumProcs function takes a pointer to a callback function
+// that will be called once per process in the system providing
+// process EXE filename and process ID.
+// Callback function definition:
+// BOOL CALLBACK Proc( DWORD dw, LPCSTR lpstr, LPARAM lParam ) ;
+//
+// lpProc -- Address of callback routine.
+//
+// lParam -- A user-defined LPARAM value to be passed to
+// the callback routine.
+BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam )
+{
+ OSVERSIONINFO osver ;
+ HINSTANCE hInstLib ;
+ HINSTANCE hInstLib2 ;
+ HANDLE hSnapShot ;
+ PROCESSENTRY32 procentry ;
+ BOOL bFlag ;
+ LPDWORD lpdwPIDs ;
+ DWORD dwSize, dwSize2, dwIndex ;
+ HMODULE hMod ;
+ HANDLE hProcess ;
+ char szFileName[ MAX_PATH ] ;
+ EnumInfoStruct sInfo ;
+
+ // ToolHelp Function Pointers.
+ HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
+ BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
+ BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
+
+ // PSAPI Function Pointers.
+ BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * );
+ BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *,
+ DWORD, LPDWORD );
+ DWORD (WINAPI *lpfGetModuleFileNameEx)( HANDLE, HMODULE,
+ LPTSTR, DWORD );
+
+ // VDMDBG Function Pointers.
+ INT (WINAPI *lpfVDMEnumTaskWOWEx)( DWORD,
+ TASKENUMPROCEX fp, LPARAM );
+
+
+ // Check to see if were running under Windows95 or
+ // Windows NT.
+ osver.dwOSVersionInfoSize = sizeof( osver ) ;
+ if( !GetVersionEx( &osver ) )
+ {
+ return FALSE ;
+ }
+
+ // If Windows NT:
+ if( osver.dwPlatformId == VER_PLATFORM_WIN32_NT )
+ {
+
+ // Load library and get the procedures explicitly. We do
+ // this so that we don't have to worry about modules using
+ // this code failing to load under Windows 95, because
+ // it can't resolve references to the PSAPI.DLL.
+ hInstLib = LoadLibraryA( "PSAPI.DLL" ) ;
+ if( hInstLib == NULL )
+ return FALSE ;
+
+ SYSTEM_INFO systemInfo;
+
+ GetSystemInfo(&systemInfo);
+ bool isWin64 = systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
+
+ if(!isWin64)
+ {
+ hInstLib2 = LoadLibraryA( "VDMDBG.DLL" ) ;
+ if( hInstLib2 == NULL )
+ return FALSE ;
+ }
+
+ // Get procedure addresses.
+ lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))
+ GetProcAddress( hInstLib, "EnumProcesses" ) ;
+ lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
+ DWORD, LPDWORD)) GetProcAddress( hInstLib,
+ "EnumProcessModules" ) ;
+ lpfGetModuleFileNameEx =(DWORD (WINAPI *)(HANDLE, HMODULE,
+ LPTSTR, DWORD )) GetProcAddress( hInstLib,
+ "GetModuleFileNameExA" ) ;
+ if(!isWin64)
+ {
+ lpfVDMEnumTaskWOWEx =(INT(WINAPI *)( DWORD, TASKENUMPROCEX,
+ LPARAM))GetProcAddress( hInstLib2, "VDMEnumTaskWOWEx" );
+ }
+ if( lpfEnumProcesses == NULL ||
+ lpfEnumProcessModules == NULL ||
+ lpfGetModuleFileNameEx == NULL ||
+ (!isWin64 && lpfVDMEnumTaskWOWEx == NULL))
+ {
+ FreeLibrary( hInstLib ) ;
+ if(!isWin64)
+ {
+ FreeLibrary( hInstLib2 ) ;
+ }
+ return FALSE ;
+ }
+
+ // Call the PSAPI function EnumProcesses to get all of the
+ // ProcID's currently in the system.
+ // NOTE: In the documentation, the third parameter of
+ // EnumProcesses is named cbNeeded, which implies that you
+ // can call the function once to find out how much space to
+ // allocate for a buffer and again to fill the buffer.
+ // This is not the case. The cbNeeded parameter returns
+ // the number of PIDs returned, so if your buffer size is
+ // zero cbNeeded returns zero.
+ // NOTE: The "HeapAlloc" loop here ensures that we
+ // actually allocate a buffer large enough for all the
+ // PIDs in the system.
+ dwSize2 = 256 * sizeof( DWORD ) ;
+ lpdwPIDs = NULL ;
+ do
+ {
+ if( lpdwPIDs )
+ {
+ HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ;
+ dwSize2 *= 2 ;
+ }
+ lpdwPIDs = (LPDWORD)HeapAlloc( GetProcessHeap(), 0, dwSize2 );
+ if( lpdwPIDs == NULL )
+ {
+ FreeLibrary( hInstLib ) ;
+ if(!isWin64)
+ {
+ FreeLibrary( hInstLib2 ) ;
+ }
+ return FALSE ;
+ }
+ if( !lpfEnumProcesses( lpdwPIDs, dwSize2, &dwSize ) )
+ {
+ HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ;
+ FreeLibrary( hInstLib ) ;
+ if(!isWin64)
+ {
+ FreeLibrary( hInstLib2 ) ;
+ }
+ return FALSE ;
+ }
+ }while( dwSize == dwSize2 ) ;
+
+ // How many ProcID's did we get?
+ dwSize /= sizeof( DWORD ) ;
+
+ // Loop through each ProcID.
+ for( dwIndex = 0 ; dwIndex < dwSize ; dwIndex++ )
+ {
+ szFileName[0] = 0 ;
+ // Open the process (if we can... security does not
+ // permit every process in the system).
+ hProcess = OpenProcess(
+ PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, lpdwPIDs[ dwIndex ] ) ;
+ if( hProcess != NULL )
+ {
+ // Here we call EnumProcessModules to get only the
+ // first module in the process this is important,
+ // because this will be the .EXE module for which we
+ // will retrieve the full path name in a second.
+ if( lpfEnumProcessModules( hProcess, &hMod,
+ sizeof( hMod ), &dwSize2 ) )
+ {
+ // Get Full pathname:
+ if( !lpfGetModuleFileNameEx( hProcess, hMod,
+ szFileName, sizeof( szFileName ) ) )
+ {
+ szFileName[0] = 0 ;
+ }
+ }
+ CloseHandle( hProcess ) ;
+ }
+ // Regardless of OpenProcess success or failure, we
+ // still call the enum func with the ProcID.
+ if(!lpProc( lpdwPIDs[dwIndex], 0, szFileName, lParam))
+ break ;
+
+ // Did we just bump into an NTVDM?
+ if(!isWin64 && _stricmp( szFileName+(strlen(szFileName)-9),
+ "NTVDM.EXE")==0)
+ {
+ // Fill in some info for the 16-bit enum proc.
+ sInfo.dwPID = lpdwPIDs[dwIndex] ;
+ sInfo.lpProc = lpProc ;
+ sInfo.lParam = lParam ;
+ sInfo.bEnd = FALSE ;
+ // Enum the 16-bit stuff.
+ lpfVDMEnumTaskWOWEx( lpdwPIDs[dwIndex],
+ (TASKENUMPROCEX) Enum16,
+ (LPARAM) &sInfo);
+
+ // Did our main enum func say quit?
+ if(sInfo.bEnd)
+ break ;
+ }
+ }
+
+ HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ;
+ if(!isWin64)
+ {
+ FreeLibrary( hInstLib2 ) ;
+ }
+
+ // If Windows 95:
+ }else if( osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
+ {
+
+
+ hInstLib = LoadLibraryA( "Kernel32.DLL" ) ;
+ if( hInstLib == NULL )
+ return FALSE ;
+
+ // Get procedure addresses.
+ // We are linking to these functions of Kernel32
+ // explicitly, because otherwise a module using
+ // this code would fail to load under Windows NT,
+ // which does not have the Toolhelp32
+ // functions in the Kernel 32.
+ lpfCreateToolhelp32Snapshot=
+ (HANDLE(WINAPI *)(DWORD,DWORD))
+ GetProcAddress( hInstLib,
+ "CreateToolhelp32Snapshot" ) ;
+ lpfProcess32First=
+ (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
+ GetProcAddress( hInstLib, "Process32First" ) ;
+ lpfProcess32Next=
+ (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
+ GetProcAddress( hInstLib, "Process32Next" ) ;
+ if( lpfProcess32Next == NULL ||
+ lpfProcess32First == NULL ||
+ lpfCreateToolhelp32Snapshot == NULL )
+ {
+ FreeLibrary( hInstLib ) ;
+ return FALSE ;
+ }
+
+ // Get a handle to a Toolhelp snapshot of the systems
+ // processes.
+ hSnapShot = lpfCreateToolhelp32Snapshot(
+ TH32CS_SNAPPROCESS, 0 ) ;
+ if( hSnapShot == INVALID_HANDLE_VALUE )
+ {
+ FreeLibrary( hInstLib ) ;
+ return FALSE ;
+ }
+
+ // Get the first process' information.
+ procentry.dwSize = sizeof(PROCESSENTRY32) ;
+ bFlag = lpfProcess32First( hSnapShot, &procentry ) ;
+
+ // While there are processes, keep looping.
+ while( bFlag )
+ {
+ // Call the enum func with the filename and ProcID.
+ if(lpProc( procentry.th32ProcessID, 0,
+ procentry.szExeFile, lParam ))
+ {
+ procentry.dwSize = sizeof(PROCESSENTRY32) ;
+ bFlag = lpfProcess32Next( hSnapShot, &procentry );
+ }else
+ bFlag = FALSE ;
+ }
+
+
+ }else
+ return FALSE ;
+
+ // Free the library.
+ FreeLibrary( hInstLib ) ;
+
+ return TRUE ;
+}
+
+BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16,
+ PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined )
+{
+ BOOL bRet ;
+
+ EnumInfoStruct *psInfo = (EnumInfoStruct *)lpUserDefined ;
+
+ bRet = psInfo->lpProc( psInfo->dwPID, hTask16, pszFileName,
+ psInfo->lParam ) ;
+
+ if(!bRet)
+ {
+ psInfo->bEnd = TRUE ;
+ }
+
+ return !bRet;
+}
+
+BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM )
+{
+ cout << setw(10) << pid << '\t' << procName << '\n';
+ return TRUE;
+}
diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp
index d14d3c49bc1..da100f1a4e5 100644
--- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp
+++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp
@@ -1,117 +1,117 @@
-# Microsoft Developer Studio Project File - Name="listtasks" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=listtasks - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "listtasks.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "listtasks.mak" CFG="listtasks - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "listtasks - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "listtasks - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "listtasks - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "listtasks - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "listtasks - Win32 Release"
-# Name "listtasks - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\listtasks.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"stdafx.h"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\listtasks.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="listtasks" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=listtasks - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "listtasks.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "listtasks.mak" CFG="listtasks - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "listtasks - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "listtasks - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "listtasks - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "listtasks - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "listtasks - Win32 Release"
+# Name "listtasks - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\listtasks.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\listtasks.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw
index 329bd2f44e0..914555a178f 100644
--- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw
+++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "listtasks"=.\listtasks.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "listtasks"=.\listtasks.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h
index ded4503f798..67cf3be123d 100644
--- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h
+++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2002 - 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- *******************************************************************************/
-#include <windows.h>
-
-#ifndef __LISTTASKS_H
-#define __LISTTASKS_H
-
-typedef BOOL (CALLBACK *PROCENUMPROC)( DWORD, WORD, LPSTR,
- LPARAM ) ;
-
-BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam ) ;
-
-
+/*******************************************************************************
+ * Copyright (c) 2002 - 2005 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ *******************************************************************************/
+#include <windows.h>
+
+#ifndef __LISTTASKS_H
+#define __LISTTASKS_H
+
+typedef BOOL (CALLBACK *PROCENUMPROC)( DWORD, WORD, LPSTR,
+ LPARAM ) ;
+
+BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam ) ;
+
+
#endif \ No newline at end of file

Back to the top