Fog Creek Software
Discussion Board




CreateProcess API and getprotobyname

Just a quick Windows question. I've already worked around this problem, but I found the behavior strange enough to ask about it...

I wrote a (ActiveState) Perl program awhile back to grab information from some web pages using the LWP::UserAgent package. The script worked great; until I tried to invoke it from a VB6 app (I'm sick, I know) using the CreateProcess API call and WaitForSingleObject. I kept getting the error HTTP 500 and "Bad Protocol ('tcp')". Perl documentation indicates that this means the call to "getprotobyname" is failing. The Perl program works flawlessly when I invoke it at the command line. I set all the SECURITY_ATTRIBUTES in the CreateProcess call to inherit handles and so on. In short, why can't my child process access the network?

Any insights or troubleshooting suggestions accepted...

Thanks

Rob VH
Thursday, February 12, 2004

Is your VB app running interactively or as a service?

Why aren't you using NULL for SECURITY_ATTRIBUTES?

Joel Spolsky
Fog Creek Software
Thursday, February 12, 2004

The VB app is running interactively. I even altered the CreateProcess declaration to match the one in the Appleman book. This allows passing 0&, 0& by value for the security settings rather than the SECURITY_ATTRIBUTES structs by ref, which is the declaration I got from the API text viewer utility...

I'm stumped. I ended up just rewriting the logic using VB code.

Rob VH
Thursday, February 12, 2004

*  Recent Topics

*  Fog Creek Home