Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get ProcessID from Module Name

Posted on 1998-09-30
13
Medium Priority
?
477 Views
Last Modified: 2013-12-03
I use CreateProcess to start InstallShield setup.exe - but the setup.exe immediately starts _isdel.exe and terminates. I can't use WaitForSingleObject on setup.exe process ID because it terminates right away.

I need to get a ProcessID for _isdel.exe - but I can't find anyway to do this. OpenProcess seems only designed to get the current ProcessID.

I want to avoid ToolHelp stuff cuz I need a 95/NT solution (and this is too small a task for me to warrent two coding solutions per platform).

(Anyone know of any documentation that lists each Windows object (handle, module, etc.) and shows all paths from here to there? (e.g. I've got X and need Y - how do I get there?))
0
Comment
Question by:chrismo
[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
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1414926
chrismo,

well, I know it's not what you wanted...

You could determine which operating system is running (GetVersionEx) and then use either toolhelp functions (win95/win98/winNT5) or "psApi.dll" stuff (winNT4) to enumerate all running processes.

Regards, Madshi.
0
 
LVL 2

Expert Comment

by:lucidity
ID: 1414927
http://www.geocities.com/ResearchTriangle/Lab/5376/Spells/TMan/index.html

The above link is source for a Process ID enumerator, It stores the ID in a structure along with the .EXE name. So if you match the .EXE name you can get the PID and whamo, do what ever you want with it, or just wait until its done.
0
 

Author Comment

by:chrismo
ID: 1414928
(a) I'm coding in Delphi (sorry I forgot to mention) - so I can't use any C++ code. I can do the translation - but ...
(b) I need the details - not a reference to a site that has some source code that's dependent on other source code that I've got to download and wade through. I appreciate the links - they're better than nothing - but, to me, they hardly qualify as an answer. Especially if digging through source code to the Platform SDK's source code merely yields ToolHelp(95)/PSAPI(NT) calls at root, which is what I suspect is going on with the source you've referred me to.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 86

Expert Comment

by:jkr
ID: 1414929
When calling 'CreateProcess', the system fills in a PROCESS_INFO structure which holds a member named 'dwProcessId' - i think that's what you need...
0
 

Author Comment

by:chrismo
ID: 1414930
Sorry. In my case I stated in my question - I use CreateProcess to start Setup.exe - Setup.exe then creates another process (_isdel.exe) and shuts down.

I need my app to wait until _isdel.exe is finished. But - I don't have its process ID - how do I get it? I cannot use Toolhelp / PSAPI (for my own reasons) ...
0
 
LVL 86

Expert Comment

by:jkr
ID: 1414931
Well, if you weren't using Delphi, i'd have suggested taking a look at the sources of the 'Process Viewer' that's shipped with VC++...
0
 
LVL 86

Accepted Solution

by:
jkr earned 400 total points
ID: 1414932
Ooops ....
If all you have to do is wait for the termination of _isdel.exe, i'd suggest a totally different approach: As _isdel.exe is the deleter process for the temporary installation files (and usually deletes itself, use 'FindFirst/NextChangeNotification()' to get notified about the changes. Then, check whether _isdel.exe is still present and continue waiting until it is deleted.
0
 

Author Comment

by:chrismo
ID: 1414933
So ... use FindFirst with FILE_NOTIFY_CHANGE_FILE_NAME on _isdel.exe and wait until it's deleted, eh? Not a bad idea. That'd probably work.

Well - not exactly what I was looking for - but does what I need - what the hey.
0
 
LVL 86

Expert Comment

by:jkr
ID: 1414934
Ooops, it won't be that easy i think, but you got the idea ;-)
The problem is when 2 installation programs are running simultaneously (just imagine another one is started to install e.g. a database engine), you'll have to keep track of what's going on...
0
 

Author Comment

by:chrismo
ID: 1414935
True enough - but I'll handle that if and when I come to it. Thanks for the input...

BTW, is there *anyway* to do what I originally asked for other than use Toolhelp? Or is the answer "Duh - use Toolhelp, that's exactly why it's there...")?
0
 
LVL 86

Expert Comment

by:jkr
ID: 1414936
Well, i actually don't know 'Toolhelp' (prefer to use NT), but there are some undocumented NT kernel routines to do this ('NtQuerySystemInformation()'). An other possibility would have been to scan the PID range using 'OpenProcess()' in conjunction with 'ReadProcessMemory()' (heavy & crude) or the symbol functions of imagehlp.dll.
0
 

Author Comment

by:chrismo
ID: 1414937
Hmmm ... OK - thanks for the help.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1414938
chrismo,

with NT you can use the PsApi.Dll to enumerate all process IDs. It is documented!

Regards, Madshi.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

610 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