Doug Hale wrote:
>   Everything works but the ShellExecute. I've used shellexecute many 
> times with no problems.
> 
> I am getting a 42 as the return code but I have not been able to find a 
> definition of 42.

That value just means, "It worked." Values less than or equal to 32 are 
error codes. Everything else just means the function succeeded. MSDN 
explains the details.

If you need to know more about the program you're starting, then you 
need to use something other than ShellExecute, such as CreateProcess.

>        RC := ShellExecute(0, '', 'full path name to exe', 
> PAnsiChar(ArgsStr), 'path to ececute in', 0);

Since you know the full path to the EXE file, you really don't need the 
shell's help in executing the program. Just use CreateProcess.

> it was  mentioned that some web servers won't allow CGI apps to spawn 
> other apps.
> How could Apache prevent that?

It could register itself as a debugger, which would allow it to be 
notified whenever the program it's debugging spawns another process.

Or, it could detect when your process ends, and if that process has any 
child processes still running, it could terminate them.

Maybe it could set the security permissions for your process to disallow 
new processes. I'm not sure whether Windows actually offers that option.

I don't know whether the Windows version actually enforces the 
no-children rule, but if it really wanted to, it could.

> I also tried CreateProcess, which I have used before, but it doesn't 
> work either but it returns True!

True means it *did* work. What problem are you having?

> I also went in to the Apache Service properties and had it login to a 
> user account instead of using
> the Local System account without success.

I think that's generally a good way to configure a server anyway. That 
way, the server can only access the minimum required for serving Web 
pages instead of having access to so many other files that it doesn't 
really need to be able to read or write.

-- 
Rob

Reply via email to