I have a DLL that is exporting a function.
If i add the DLL in the import section of the PE that needs it, everything goes okay.
but if i try to load the DLL dynamic with LoadLibraryA & GetProcAddress i get
"the specified procedure could not be found".. however if the DLL is in the import section of the calling PE everything works. Can someone here maybe explain why that is ?
just like it is in the official fasm's example (at least in current versions). Otherwise you don't really know what the status of "last error" is.
Wow! Tomasz Grysztar himself comes and helps me out Ofcource it works now! thank you Tomasz Grysztar. But still.. Can you explain why the result trough LoadLibrary produces a different result ? Because with the normal import i did not need SetLastError. Lets say i really want to get last error this way, wont putting invoke SetLastError,0 result to last error always being "the operation completed successfully" ?
GetLastError returns the most recent value in the error variable. So the value it contains depends upon the last operation you did.
I expect that GetProcAddress will firstly set the error variable to "the specified procedure could not be found" and then do its work. So that way if the return value is null then the error variable contains the proper error value. Otherwise if the return value is a valid pointer then the error value is expected to be ignored. But in your code you print the error value even though the last operation was successful.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum