Hi all,
I've been really struggling with the below function, and after consulting ye olde archives cant seem to find a solution.
I'm using loadlibrary to load in a dll, nothing fancy just normal loadlibrary
It works 100% ok in win98, but in win2k i keep getting error 126 (module not found) and the dll IS there.
invoke LoadLibrary,addr DLLname2 ;Load the DLL and get its handle
.if eax==NULL
invoke GetErrDescription,0
invoke MessageBox,NULL,addr DllNotFound1,addr Appname,MB_OK
return 0
.else
mov hDLL, eax
invoke LoadProcs,hDLL ; Get the addresses of the procedures
.if eax==NULL
return 0
.else
.endif
as you can see nothing terribly complex, but why o why wont it work in win2k - I was thinking a unicode thing, maybe i need to double zero terminate the dll string?
platformsdk docs dont seem to suggest it
any help GREATLY appreciated
I've been really struggling with the below function, and after consulting ye olde archives cant seem to find a solution.
I'm using loadlibrary to load in a dll, nothing fancy just normal loadlibrary
It works 100% ok in win98, but in win2k i keep getting error 126 (module not found) and the dll IS there.
invoke LoadLibrary,addr DLLname2 ;Load the DLL and get its handle
.if eax==NULL
invoke GetErrDescription,0
invoke MessageBox,NULL,addr DllNotFound1,addr Appname,MB_OK
return 0
.else
mov hDLL, eax
invoke LoadProcs,hDLL ; Get the addresses of the procedures
.if eax==NULL
return 0
.else
.endif
as you can see nothing terribly complex, but why o why wont it work in win2k - I was thinking a unicode thing, maybe i need to double zero terminate the dll string?
platformsdk docs dont seem to suggest it
any help GREATLY appreciated
Im not an expert with ASM or MASM so I will give my 2c worth based on other factors that can make a DLL fail to load.
1. Check the name of the DLL is null terminated.
2. Check that the DLL is in a folder that is in your PATH environment variable, or put the DLL in the same folder as the program that you are executing. Windows will try and find the DLL in the current folder, then it will search the path.
3. You could also try hard coding the full path to the DLL to avoid any issues with (2) and just test that the DLL is being loaded.
Also, check out
http://www.asmcommunity.net/board/index.php?topic=19
for info on building and using DLL's in ASM.
I sure hope this helps.
Keep well - Regs James.
1. Check the name of the DLL is null terminated.
2. Check that the DLL is in a folder that is in your PATH environment variable, or put the DLL in the same folder as the program that you are executing. Windows will try and find the DLL in the current folder, then it will search the path.
3. You could also try hard coding the full path to the DLL to avoid any issues with (2) and just test that the DLL is being loaded.
Also, check out
http://www.asmcommunity.net/board/index.php?topic=19
for info on building and using DLL's in ASM.
I sure hope this helps.
Keep well - Regs James.
I've had a problem with an application that tried to LoadLibrary("foo") and would work on Windows 98, but not on Windows 2000. foo.dll did exist. Apparently, renaming the file to just foo (no extension), fixed the problem for Windows 2000. This is very weird, because I know for sure LoadLibrary("user32") works on Windows 2000.
I suspect that LoadLibrary("user32") works because user32.dll is already loaded when you start the application. The three core DLLs (kernel32.dll, user32.dll, and gdi32.dll) are always present when your program starts, regardless of whether you linked them in or not. They sit in the "system" address space.
If you try to load the same DLL twice without releasing them, you will only get one instance of the DLL.
If you try to load the same DLL twice without releasing them, you will only get one instance of the DLL.