Re: Threads, modules, processes...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



TKS Michael,
I'll try to find pkfuncs.h and check it.

But in the meantime I'll answer to your "Why?" question:
I've recently switched from an X50v to an X51v to find that my CF card GPS
(Haicom HI-303S) didn't work in WM5: It starts ok, but after an only cycle
of open port and close port, it hanged.
I talk about the problem with Haicom first and with Elan later (Elan is the
maker of the chipset that the GPS uses in the CF: VPU16550) and they told me
about a problem with several machines, CF capables, and WM5 anabled that
have problems with the timing of the CF card. Elan sent me a patch and it
modified three registers of the CPU and make all programs but TTN5 work
perfectly. The patch was a new serial.dll called elSerial.dll.

But with TomTom Navigator 5 a new problem begun: If TTN5 was minimized (
in the background), all worked well and The GPS navigation instructions
could be heared by the speaker, but when TTN5 were brought to foreground,
the GPS seemed to freeze and didn`t change position until with a HW maped
key I brought back TTN5 to background.

It makes me thing that TTN5, a program known because it takes all the CPU it
have, would be "eclipsing" in the dispatcher the task that managed the CF
and the Serial port of the CF card.

Then I used your great program, ENTREK procman to find the thread. To do
this I started the machine and connected itto the PC, wait for two minutes,
plug the GPS into the CF slot and looked at the device.exe threads.The last
one started was obviously the one wat I was looking for. I modified its
priority to 249 and without turn off the PPC I started TTN5, disconnect
from the PC and wen to the street:

It worked for the firs time on my X51: The solution was near.

But I dont know if the problem is with the serial driver or with the PCMCIA
driver (both becomes active when inserting the card). And I want a way to
thest changing the prioritys of the trheads involved.


Sorry for the extent of the answer... and thanks again.

beemer
http://personales.ya.com/beemer





"Michael J. Salamone" <mikesa#at#entrek#dot#com> escribió en el mensaje
news:OkV6aiXLGHA.536@xxxxxxxxxxxxxxxxxxxxxxx
Certainly several threads can be started from the same module. If you
know the base address (which is hard to know, but you can figure it out in
the debugger by debugging the thread and looking at its base address - but
that base can change when you make changes to your DLL). Even that isn't
definitive, though, because the API reports back return addresses. If the
serial DLL thread you are interested in has a unique priority, you could
query the priority (and then you don't even have to bother with
GetCallStackSnapshot if it's unique within device.exe). But if you aren't
writing the DLL/thread, you may see variances from one Pocket PC to the
next.

It turns out that GetCallstackSnapshot is an OEM call (I think MS should
put it in the SDK). You'd have to get the WinCE eval software from
microsoft.com and then check pkfuncs.h.

I should have asked - once you know what thread it is, what do you plan to
do? There may be another solution that is better than messing with the
stuff above.

--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


"beemer" <beemer(antispam)@teleline.es> wrote in message
news:uq97REWLGHA.1132@xxxxxxxxxxxxxxxxxxxxxxx
Thanks Michael.
Sorry for the stupid code errors, Ops...

As I have understood there is no way to relationate a thread with a
module because the process can create many threads with one or more
modules inviolved. That's right?
I didn't know the CallStack related functions and haven`t found many
information about them in MSDN and Google.

Could you recomend me some links where I cand find information about how
to use these funcitions.

Thanks.

beemer


"Michael J. Salamone" <mikesa#at#entrek#dot#com> escribió en el mensaje
news:OSxEL8TLGHA.2124@xxxxxxxxxxxxxxxxxxxxxxx
There are quite a few problems here.

First, don't check equality of strings using ==. You have to use tcscmp
or tcsicmp.

Second, you have to call Process32Next / Thread32Next / Module32Next
(don't keep calling Process32First / Thread32First / Module32First in
the while statements (should be an infinite loop the way you have it
coded).

Third, you can't compare OwnerProcessId and ModuleId - you're comparing
apples and oranges when you do.

Last, I think the only supported way to do this is to use
GetCallStackSnapshot on each thread in device.exe, and find a callstack
that has an address (probably use the address of the 2nd or 3rd frame -
the first one will be in coredll.dll) within the serial module
(detemined by the base address and size of serial.dll as reported by
toolhelp).

--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


"beemer" <beemer(quitaesto)@teleline.es> wrote in message
news:eIC$i3QLGHA.2124@xxxxxxxxxxxxxxxxxxxxxxx

I want to find the thread created bya a module (serial.dll) of a
process (device.exe). I've written this code to do that but it didn't
work, probably because I've understood bad any concept. ¿could you help
me?

DWORD deviceProcessID,elSerialModuleID,elSerialThreadID;
HANDLE hProcessSnap = NULL;
bool foundProc=false; bool foundMod=false; bool foundThre=false;

hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0 );
THREADENTRY32 the32;
PROCESSENTRY32 pro32;
MODULEENTRY32 mod32;
the32.dwSize = sizeof( THREADENTRY32 );
pro32.dwSize = sizeof( PROCESSENTRY32 );
mod32.dwSize = sizeof( MODULEENTRY32 );
// Walk the snapshot of the processes.
if ( Process32First( hProcessSnap, &pro32 ) )
do {
if (pro32.szExeFile == _T("\\windows\\device.exe")) //Find process
device.exe
{
deviceProcessID = pro32.th32ProcessID;
foundProc=true;
break;
}
}while ( Process32First( hProcessSnap, &pro32 ) );


if ( Module32First( hProcessSnap, &mod32 ) )
do {
if (mod32.szModule == _T("elSerial.dll")) //Find module esSerial.dll
{
elSerialModuleID = mod32.th32ModuleID ;
foundMod=true;
break;
}
}while ( Module32First( hProcessSnap, &mod32 ) );


if ( Thread32First( hProcessSnap, &the32 ) )
do {
if ((the32.th32CurrentProcessID == deviceProcessID) &&
(the32.th32OwnerProcessID == elSerialModuleID))//Find module
esSerial.dll
{
elSerialThreadID = the32.th32ThreadID ;
foundThre=true;
break;
}
}while ( Thread32First( hProcessSnap, &the32 ) );

if (foundProc | foundMod | foundThre)
{
PlaySound(TEXT("alarm1.wav"),NULL,SND_ASYNC);
}

CloseToolhelp32Snapshot( hProcessSnap );












.



Relevant Pages

  • Re: Garmin Xs, memory cards, and MapSource licenses
    ... They can do that by creating separate map files for each receiver. ... I've used a Magellan GPS. ... You can create map files to the SD cards in the GPS, to the SD card in a burner with the GPS attached, or with some versions at least, the SD card in a burner, no GPS attached, and by entering the GPS receiver's hardware serial number from the keyboard when the map file is created. ... For the purchased at retail version, you do that by going online with a SD card either in a reader or a attached GPS and entering the software serial number that is on the back of the BlueNav CD-ROM case. ...
    (sci.geo.satellite-nav)
  • Re: Garmin Street Pilot C-530
    ... We don't care about Blue Tooth. ... We don't care that it doesn't announce street names, so long as they display across the top of the screen as our Garmin Quest does. ... We DO care about being able to plan a trip on the computer and send it to the GPS. ... Even my Garmin 320 will do those things once I put a larger memory card in for a few bucks. ...
    (rec.outdoors.rv-travel)
  • Re: rooftop antenna range
    ... gps to talk to me. ... but the baseline is too far from Santa Cruz and their antenna is ... I was more interested in this card for its RX sensitivity. ... Fresnel Zone is a knife edge diffraction ...
    (alt.internet.wireless)
  • Re: Garmin Street Pilot C-530
    ... We don't care about Blue Tooth. ... We DO care about being able to plan a trip on the computer and send it to the GPS. ... Even my Garmin 320 will do those things once I put a larger memory card in for a few bucks. ... I haven't used mine but a month or so ago I posted a link to a download that allowed a Garmin GPS to be loaded with data from Street Atlas and various overlays of gas stations, POIs, restaurants, etc. ...
    (rec.outdoors.rv-travel)
  • Re: eten Glofiish x800 vs Tilt
    ... Isn't that pretty much the Tilt with WMPro 5 and no GPS?? ... so phone reception is a very high priority. ... separate bluetooth receiver) is a priority, ...
    (microsoft.public.pocketpc)