One thing I see right away is that HOSTENT is an actual memory address, and you're using PeekInt as if it reads straight from memory. That won't work. PeekInt reads from a BANK, which is 1 layer of abstraction away from direct memory access. What you should probably do is use RtlMoveMemory (kernel32) to copy the contents at HOSTENT into a bank that you can then read with Peek.
Also, I'm not sure that the third parameter of CallDLL (for gethostbyname) will work with a string. It didn't with me. Instead of using LocalHostName$, I would use what's in tempbank (from the GetHostName function, but global).
Is there some reason why you're using CallDLL instead of decls files?
Also, I'm not sure that the third parameter of CallDLL (for gethostbyname) will work with a string. It didn't with me. Instead of using LocalHostName$, I would use what's in tempbank (from the GetHostName function, but global).
Is there some reason why you're using CallDLL instead of decls files?