I have the following scenario where the dwThreadId of
PROCESS_INFORMATION does not match the corresponding dwProcessId.

This is what I do.


Code:
--------------------

LPSECURITY_ATTRIBUTES psa = 0;
PROCESS_INFORMATION pi = {0};
STARTUPINFO* ps = 0;
STARTUPINFO si = {0};
si.cb = sizeof (STARTUPINFO);
si.dwFlags = 1;
si.wShowWindow = wShow;
ps = &si;

if (::CreateProcess (TEXT ("\\windows\\wceload.exe") ,TEXT ("/silent \"my.cab\""), psa, 0, FALSE, 0, 0, 0, ps, &pi))
{
LOG (TEXT ("Process Id for wceload=[%x]"), pi.dwProcessId);
LOG (TEXT ("Thread Id for wceload=[%x]"), pi.dwThreadId);
// Rest of the logic goes here.
}

--------------------


Now in my log file, I get

Re: wceload dwThreadID vs dwProcessId by vino

vino
Wed Sep 20 01:23:20 CDT 2006


Sorry for the 1st post in this thread. I cant edit my own posts :-(

I have the following scenario where the dwThreadId of
PROCESS_INFORMATION does not match the corresponding dwProcessId.

This is what I do.


Code:
--------------------

LPSECURITY_ATTRIBUTES psa = 0;
PROCESS_INFORMATION pi = {0};
STARTUPINFO* ps = 0;
STARTUPINFO si = {0};
si.cb = sizeof (STARTUPINFO);
si.dwFlags = 1;
si.wShowWindow = wShow;
ps = &si;

if (::CreateProcess (TEXT ("\\windows\\wceload.exe") ,TEXT ("/silent \"my.cab\""), psa, 0, FALSE, 0, 0, 0, ps, &pi))
{
LOG (TEXT ("Process Id for wceload=[%x]"), pi.dwProcessId);
LOG (TEXT ("Thread Id for wceload=[%x]"), pi.dwThreadId);
// Rest of the logic goes here.
}

--------------------


Now in my log file, I get

Process Id for wceload=[f8105d2]
Thread Id for wceload=[ed69926]

Using Windows CE Remote Process Viewer, I can see that the thread id
belongs to the process gwes.exe and not wceload. I thought dwThreadId
would give me the thread id that belongs to the dwProcessId. What is
happening here ? Is this the expected behaviour ?

Is there any mechanism where I can get the thread Id that belongs to
the process that was created.

Thanks,
Vino