Though it's nothing much, I think you'll like it. I used it to restrict access to my PC, coz I was pissed off by my sister. The password is 1337
note that my Windows dir is "Zombie", and you need to recompile to your dir.
after you compile it, place it in C:\explorer.exe.
Posted on 2003-04-04 00:26:56 by Ultrano
What is the equivalent API in win98 for "Shell".

There is ShellExecuteEx but its anoying to fill out and get working ;)

Is there a better version?
:NaN:
Posted on 2003-04-07 16:54:39 by NaN


; from masm32lib
shell proc lpfilename:DWORD

LOCAL xc :DWORD ; exit code

.data
st_info STARTUPINFO <0>
pr_info PROCESS_INFORMATION <0>
.code

invoke CreateProcess,NULL,lpfilename,NULL,NULL,
NULL,NULL,NULL,NULL,
ADDR st_info,
ADDR pr_info

; -------------------------------------------
; loop while created process is still active
; -------------------------------------------
@@:
invoke GetExitCodeProcess,pr_info.hProcess,ADDR xc
cmp xc, STILL_ACTIVE
je @B

ret

shell endp


You'd better not use the looping part, I was lazy to use CreateProcess, and my proggie with shell() apparently stays running until you turn the pc off. :rolleyes:
Posted on 2003-04-07 22:12:09 by Ultrano
don't tell me that's the code for shell... geez. looping GetExitCodeProcess?
You should WaitForSingleObject on pi.hProcess. And the proc doesn't do
CloseHandle on hThread and hProcess :eek:
Posted on 2003-04-08 02:19:16 by f0dder
Grin,

Its not supposed to, it starts a single process and waits for it to finish, just like the GetExitCodeProcess is designed to do.

Regards,

hutch@movsd.com
Posted on 2003-04-08 03:38:08 by hutch--
WaitForSingleObject is better. It blocks your thread until the process is done, which is more effective than constantly looping GetExitCodeThread. And yes, you _should_ CloseHandle on hThread and hProcess even after process is done executing, as the kernel objects will otherwise remain until your own process terminates. If you don't believe me, wonder why you can do GetExitCodeProcess _after_ the child process has terminated.
Posted on 2003-04-08 03:41:15 by f0dder
Quoting PlatformSDK:

Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer needed.


previous threads about this subject (Svin also recommends using WaitForSingleObject instead of the stupid GetExitCodeProcess loop)
http://www.asmcommunity.net/board/index.php?topic=4576&highlight=WaitForSingleObject

readiosys, too:
http://www.asmcommunity.net/board/index.php?topic=5157&highlight=WaitForSingleObject

Time to fix up m32lib shell(), having the windows thread scheduler blocking until child process terminates is better than wasting cycles on the GetExitCodeProcess loop.

Even if you don't want to replace the loop, at least do the CloseHandle's. Leaks in a generic piece of code used by a bunch of people == bad.
Posted on 2003-04-08 11:57:24 by f0dder