• Welcome to Valhalla Legends Archive.
 

DLLs & messages for them

Started by tA-Kane, January 25, 2005, 03:08 AM

Previous topic - Next topic

Adron

You don't get your own address space as a DLL; you share address space with the rest of the process. And Winsock only needs to be initialized once for the entire process.

tA-Kane

Probably a dumb question, but can anything *bad* happen from nested calls to WSAStartup()/WSACleanup? My DLL seems to be working fine right now, for how far I've implemented it (it's able to connect to a server and send data; packetlogged it so I know it's working).
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Kp

#17
My understanding is that WinSock must be explicitly initialized on a per-process basis (oppose the Unix model, where socket libraries don't require any warning before you use them).  So the only case in which you might need to call WSAStartup is if you can get loaded before SphtBot performs its WSAStartup (which it must do before connecting to battle.net). :)

As for nesting: I think it just increments/decrements a reference counter, so no, nothing bad will happen as long as you're careful to call WSACleanup exactly as many times as you called WSAStartup.  Calling it too many times might cut off the host process's use of winsock prematurely.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!