Bug with Synaptics drivers and Tool Helper functions in Windows 2000?

Hi all,

I’m writing a routine that is supposed to generate a list of all
processes and their associated modules currently running in the system.
In Windows 9x/ME and Windows 2000, I’m using the Tool Helper functions
(CreateToolHelp32SnapShot, Process32First/Next, Module32First/Next).
This works fine except on Windows 2000 laptops that have drivers for the
Synaptics touchpad installed.

On these systems, the call to Module32First() for SynTPEnh.exe
(“Synaptics TouchPad Enhancements”) hangs. This does not happen on a
identical machine that has Windows 9x/ME and Synaptics drivers
installed.

Also, while Module32First() hangs, CPU usage is at 100% and doesn’t go
down again even after killing my program. When I then try to shutdown,
the system notifies me that the “Touchpad driver tray icon window” is
not responding.

So, is this a bug in Windows 2000 (tried SP0, SP1 and SP2) or the
Synaptics drivers (tried various versions) or my code (see below)? Is it
possible for an application to be “incompatible” with the tool helper
functions?

FYI, to workaround this, I have written a routine that uses functions in
PSAPI.DLL in Windows 2000 to get the process/modules list. No problems
on the offending machines.

Here is the code that uses Tool Helper functions:

//==============================================================================
#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

BOOL GetProcessList (void);
BOOL GetProcessModuleList (DWORD);

BOOL GetProcessList()
{
HANDLE hProcessSnap = NULL;
PROCESSENTRY32 pe32 = {0};
BOOL bRet = FALSE;

hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

if (hProcessSnap == INVALID_HANDLE_VALUE)
return bRet;

pe32.dwSize = sizeof(PROCESSENTRY32);

if (Process32First(hProcessSnap, &pe32))
{
do
{
bRet = TRUE;

if (offsetof(PROCESSENTRY32, szExeFile) <= pe32.dwSize)
printf(“%s\n”, pe32.szExeFile);

if (offsetof(PROCESSENTRY32, th32ProcessID) <= pe32.dwSize)
GetProcessModuleList(pe32.th32ProcessID);

printf(“\n”);
pe32.dwSize = sizeof(PROCESSENTRY32);
}
while (Process32Next(hProcessSnap, &pe32));
}
CloseHandle(hProcessSnap);
return bRet;
}

BOOL GetProcessModuleList (DWORD th32ProcessID)
{
HANDLE hModuleSnap = NULL;
MODULEENTRY32 me32 = {0};
BOOL bRet = FALSE;

hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, th32ProcessID);

if (hModuleSnap == INVALID_HANDLE_VALUE)
return bRet;

me32.dwSize = sizeof(MODULEENTRY32);

if (Module32First(hModuleSnap, &me32))
{
do
{
bRet = TRUE;

if (offsetof(MODULEENTRY32, szExePath) <= me32.dwSize)
printf(“\t%s\n”, me32.szExePath);

me32.dwSize = sizeof(MODULEENTRY32);
}
while (Module32Next(hModuleSnap, &me32));
}
CloseHandle(hModuleSnap);
return bRet;
}

int main(void)
{

if (GetProcessList())
return 0;
else
return 1;

}
//==============================================================================

Ralf.



You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</string.h></stdlib.h></stdio.h></tlhelp32.h></windows.h>