Okay, basically, everytime I try to GetModuleHandle for Wsock32.dll, or ws2_32.dll, it returns NULL even when I know that they're in memory.

Can someone tell me whats wrong, and what to do?

snippet of code:

.data
szWS db "WSOCK32.dll", 0

.data?
hWS dd ?

invoke GetModuleHandle, szWS
.IF eax == NULL
invoke MessageBox, NULL, NULL, NULL, NULL
.ENDIF
mov hWS, eax

thanks
Posted on 2003-03-22 21:33:34 by slim323
try invoke GetModuleHandle, addr szWS
Posted on 2003-03-22 22:06:29 by BubbaFate
Use LoadLibrary.
Posted on 2003-03-22 22:35:42 by comrade
Yes, the DLL's must be in use by the current process, otherwise they won't show up.
Posted on 2003-03-23 12:37:46 by Sephiroth3
Slim,

The advice here is right, because you have the DLL name in the DATA section, it is actually an offset, not a variable so with the "invoke" statement, you need to use ADDR with the variable name to get the right address.

If you have the correct file name for the DLL and you call it correctly, you should get its handle but for calling functions in the DLL, Comrade is correct, use LoadLibrary()/GetProcAddress()/FreeLibrary() to do the job and it should work OK.

Regards,

hutch@movsd.com
Posted on 2003-03-24 01:24:35 by hutch--