Request: A more transparent DLL loading mechanism

Posted By: Talemon

Request: A more transparent DLL loading mechanism - 06/10/14 11:49

I want to share a recent experience and a problem with you:
We did a "publish" on our project recently and we discovered that it didn't work and left us with a black screen. Whereas it works when we run it from the source code. It turns out that when we publish it, it gets exported with acknet.dll. We use cURL in our project and unbeknownst to us, this DLL is also compiled with cURL as a static library. Both our dll and acknet.dll expose similar functions so when the engine searches for a external function, it finds acknet first(because it searches alphabetically) and uses its functions. This didn't work for us probably because versions were different and it failed somewhere. Luckily I found this out during a debugging session but it could pass by many unfortunate souls.

I wish we could choose which DLL we want functions to be loaded because this also poses a vulnerability: any DLL can be added next to the executable with name like ___foo.dll to hijack a function.
Posted By: Ch40zzC0d3r

Re: Request: A more transparent DLL loading mechanism - 06/10/14 12:14

LoadLibraryA
GetProccAddress

Define a typedef and youre done..
Posted By: Talemon

Re: Request: A more transparent DLL loading mechanism - 06/10/14 12:45

Originally Posted By: Ch40zzC0d3r
LoadLibraryA
GetProccAddress

Define a typedef and youre done..

You know what, you're right, I should have sticked with the classic method instead of leaving it to the engine. Thanks!
Posted By: Rackscha

Re: Request: A more transparent DLL loading mechanism - 06/17/14 11:44

as far as i know, Lite-C supports widestrings and wideliterals, so you might consider working with LoadLibraryW
Posted By: jcl

Re: Request: A more transparent DLL loading mechanism - 06/17/14 15:05

Engine DLLs have the advantange that you can use all engine variables and functions in the DLL. Otherwise the standard C method with LoadLibrary is fine.
© 2024 lite-C Forums