Sign in to follow this  
Followers 0
Guest mcleef

ProcessExists not work on NT workstation

10 posts in this topic

Dear sir:

I encounter a problem on ProcessExists() function, I execute the following code

If Not ProcessExists("rcHost.exe") Then

MsgBox(48, "Message", "rchost Not exist")

Else

MsgBox(48, "Message", "rchost exist")

Endif

I have 2 test PCs, one is Window NT workstation, another one is

Windows 2000 professional, rchost.exe is started by a automation

start service, and I am sure the rchost.exe is running from task manager.

rchost.exe is started by system account on both machine, and when I execute

the script on Windows 2000 professional, it will display "rchost exist", but when

I execute it on Windows NT workstation, it will display "rchost Not exist".

Then I open a notepad by currnt logon account, and I test another script on

the Windows NT workstation as following:

If Not ProcessExists("notepad.exe") Then

MsgBox(48, "Message", "notepad.exe Not exist")

Else

MsgBox(48, "Message", "notepad.exe exist")

Endif

It will display "notepad.exe exist"

So I think the real problem is the ProcessExists() function can't detect

a process which is started by system account on the Windows NT workstation.

Could someone kindly give me some comment to solve this problem?

I have about 3,000 NT workstation may encounter this kind of problem.

Very thanks!!

Jo.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

did you install AutoIt on these machine or do you run a compile script?

under NT AutoIt need to access to psapi.dll.

It is mentioned in the doc

Edited by jpm

Share this post


Link to post
Share on other sites

Hi JP:

Thanks for your response.

I run it after compile it, but the problem is still existed.

I also find the description about PSAIP.DLL from Help file, but I though the

description is for ProcessWaitClose function.

Do you think it also OK for my problem?

I also try to find PSAIP.DLL, but I can't find it from Internet, do you have

any idea ?

Thanks!!

Jo.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi Jo,

Here is what I would do if I faced the same situation:

  • Copy the PSAPI.DLL file from AutoIt's folder to the same folder as the uncompiled script.
  • Add If @Compiled Then FileInstall("PSAPI.DLL", @ScriptDir & "\PSAPI.DLL") at the beginning of my script.
  • Add FileDelete(@ScriptDir & "\PSAPI.DLL") at the end of my script.
  • Compile and test.
Edit: or you could just place PSAPI.DLL in the same directory as your compiled script and not modify the script. This should also work. Edited by LxP

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi JP:

Thanks for your response.

I run it after compile it, but the problem is still existed.

I also find the description about PSAIP.DLL from Help file, but I though the

description is for ProcessWaitClose function.

Do you think it also OK for my problem?

I also try to find PSAIP.DLL, but I can't find it from Internet, do you have

any idea ?

Thanks!!

Jo.

<{POST_SNAPBACK}>

You already have a psapi.dll in @ProgramFilesDir & "\AutoIt3"

If you compile you need to include the PsAPI.dll file with

FileInstall(@ProgramFilesDir & "\AutoIt3\psapi.dll", @windir & "\psapi.dll")

if your system where you are compiling as a different AutoIt install dir you need to change @ProgramFilesDir & "\AutoIt3 to the specific one. :whistle:

Edited by jpm

Share this post


Link to post
Share on other sites

Hi JP & Lxp:

Thanks for your response.

It still not works, I change my script as following

If @Compiled Then FileInstall("PSAPI.DLL", @WindowsDir & "\PSAPI.DLL")

If Not ProcessExists("rcHost.exe") Then

IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist")

Else

IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist")

Endif

And execute it after compile.

I am sure the PSAPI.DLL had copy to @WindowsDir,

but it still return "rchost Not exist", and I am sure rchost.exe is existed.

Do you have any comment?

Jo.

Share this post


Link to post
Share on other sites

Maybe @SystemDir will work better than @WindowsDir?...

Share this post


Link to post
Share on other sites

Hi JP & Lxp:

Thanks for your response.

It still not works, I change my script as following

If @Compiled Then FileInstall("PSAPI.DLL", @WindowsDir & "\PSAPI.DLL")

If Not ProcessExists("rcHost.exe") Then

      IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist")

Else

      IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist")

Endif

And execute it after compile.

I am sure the PSAPI.DLL had copy to @WindowsDir,

but it still return "rchost Not exist", and I am sure rchost.exe is existed.

Do you have any comment?

Jo.

<{POST_SNAPBACK}>

I misunderstood your problem. If there was a pb with psapi.dll you should have received a fatalerror popup.

As you just get a return = 0 that's something else.

Can you run a processlist under NT4 and display all process that's are seen?

Thanks

Share this post


Link to post
Share on other sites

Dear all:

My problem is solved.

I use the new AutoIT version V3.1.1 to compile my script.

If Not ProcessExists("rcHost.exe") Then

IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist")

Else

IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist")

Endif

The executable file size is about 110K, and same script compile

by AutoIT V 3.0.1 only about 84K, I guess the new version had

include PSAPI.DLL.

Thanks for all your help.

Jo.

Share this post


Link to post
Share on other sites

Dear all:

My problem is solved.

I use the new AutoIT version V3.1.1 to compile my script.

If Not ProcessExists("rcHost.exe") Then

      IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist")

Else

      IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist")

Endif

The executable file size is about 110K, and same script compile

by AutoIT V 3.0.1 only about 84K, I guess the new version had

include PSAPI.DLL.

Thanks for all your help.

Jo.

<{POST_SNAPBACK}>

The psapi.dll is not included in the 110K unless you use Fileinstall.

Perhaps a fix has been done in 3.1.0 to have processexists working

The only reference I can find is related to a modification included in 3.0.102 (Aug 4th, 2004)

- Fixed: Process... functions under NT4 unable to see certain processes

At least glad your problem is solved :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0