[fpc-pascal] Embedding DLL into EXE for Windows 32 bit?
José Mejuto
joshyfun at gmail.com
Sat Jul 7 13:29:23 CEST 2018
El 07/07/2018 a las 11:01, Bo Berglund escribió:
>> 1) Include the DLL as a resource and extract it to a temp location
>> before loading it
>
> I have seen these suggestions but the comments indicated that writing
> a binary file to the filesystem on startup and then calling stuff
> inside likely will trigger antivirus detection...
> See: http://www.delphipages.com/forum/showthread.php?t=216147
Hello,
This behavior raises a warning in the antivirus for sure. Not a good choice.
> This I don't understand, it does not look like they have embedded the
> dll into the application at all...
>
> In the example both tests use the same code to load the dll from the
> file system:
> ms := TMemoryStream.Create;
> ms.LoadFromFile(ParamStr(1));
> (Paramstr(1) is the required DLL path)
It uses a memory stream, no disk is touched, but in the example, for
simplicity, it reads the DLL from disk instead a resource in the EXE.
> I found another MemoryModule at GitHub named BTMemoryModule:
> https://github.com/nedich/memorymodule
> But it too looks rather involved, and is pretty old...
In my Delphi times I was using it with good results. I was trying to
port it to FPC but drop the attempt.
Anyway, using a DLL only complicates the distribution. Security is the
same as an OBJ file, a hacker can not simply replace the DLL with an
empty stub as some operations must be performed in the dongle which are
verified in the main code, the DLL is just a tunnel between application
and dongle.
--
More information about the fpc-pascal
mailing list