This code works fine on XP, but not on WinMe.
When run thru Olldbg, I get no error messages.

Any ideas?


AppName        db "Terminate",0
nice_guy        db "iexplore.exe",0
errSnapshot    db "CreateToolhelp32Snapshot failed.",0
errProcFirst    db "Process32First failed.",0

.data?

hSnapshot  HANDLE ?
ProcEnt    PROCESSENTRY32 <?>

.code

start:
    invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS,0
    .IF (eax != INVALID_HANDLE_VALUE)
        mov hSnapshot,eax
        mov ,SIZEOF ProcEnt
        invoke Process32First, hSnapshot,ADDR ProcEnt
        .IF (eax)
          @@:
            invoke lstrcmpi, ADDR nice_guy ,ADDR
            .IF (eax == 0)
                invoke OpenProcess, PROCESS_TERMINATE,FALSE,
                .IF (eax)
                    invoke TerminateProcess, eax,0
                .ELSE
                    ;failed for some reason
                .ENDIF
            .ENDIF

            invoke Process32Next, hSnapshot,ADDR ProcEnt
            test eax,eax
            jnz @B

        .ELSE
            invoke MessageBox, NULL,ADDR errProcFirst,ADDR AppName,MB_OK or MB_ICONERROR
        .ENDIF
        invoke CloseHandle, hSnapshot
    .ELSE
        invoke MessageBox, NULL,ADDR errSnapshot,ADDR AppName,MB_OK or MB_ICONERROR
    .ENDIF
    invoke ExitProcess, NULL
end start
Posted on 2010-06-02 13:30:04 by skywalker
skywalker,

Did it walk thru processes under Me? OpenProcess() can fail too.
Posted on 2010-06-02 13:47:45 by baldr
I got Error_Sucess when I went just past OpenProcess.



Posted on 2010-06-02 14:23:51 by skywalker
http://www.microsoft.com/windows/support/endofsupport.mspx

Microsoft doesn't support WinME - I don't support WinME. Anyone still on 95/98/ME has some serious issues. (Of course this useless banter is my personal opinion.)
Posted on 2010-06-02 18:24:14 by JimmyClif

http://www.microsoft.com/windows/support/endofsupport.mspx

Microsoft doesn't support WinME - I don't support WinME. Anyone still on 95/98/ME has some serious issues. (Of course this useless banter is my personal opinion.)


Your opinion is noted.
But have you thought it through.

Not everyone can upgrade.

Have a great day.
Posted on 2010-06-02 19:30:05 by skywalker
skywalker,

Are those terminated processes still functioning, or they're just hanging in memory? If latter is true, this possibly is related to handle of process not being closed. Also, your process is included in snapshot too, if it is too early in the list, y'know…
Posted on 2010-06-03 01:46:46 by baldr
Yes, the "should have  been terminated process" is still running.

I will step thru it and see what I can find.

Posted on 2010-06-04 05:49:47 by skywalker
skywalker,

I've meant, your program isn't "iexplore.exe"? Guess what will happen if Process32First() / Process32Next() enumerate it as not the last in the snapshot…
Posted on 2010-06-04 09:48:48 by baldr

skywalker,

I've meant, your program isn't "iexplore.exe"? Guess what will happen if Process32First() / Process32Next() enumerate it as not the last in the snapshot…


No, my program is called killit.
I am at a dead-end right now.

WinMe has more than a few wierd things that I haven't figured out yet. :-)


Posted on 2010-06-04 13:12:34 by skywalker

Your opinion is noted.
But have you thought it through.

Not everyone can upgrade.


According to statistics for example: http://www.w3counter.com/globalstats.php?year=2010&month=4 Windows ME doesn't even have close to 0.10%. Your intent is very noble but a waste of precious programming time.
Posted on 2010-06-04 15:08:08 by JimmyClif
I am waiting on a copy of XP-Pro I got for $34.

So, WinMe is now a dead issue.

Posted on 2010-06-08 06:28:21 by skywalker
Good. Welcome to the future :)
Posted on 2010-06-08 13:43:34 by JimmyClif

Good. Welcome to the future :)


Good. Welcome to the future near-past :P

I used to use WinME, still have it too on a VM. Didn't have as many issues as others did with it, but moving away from the 9x architecture is nothing but a good move.
Posted on 2010-06-09 11:07:06 by SpooK