Page 1 of 1

Static DLL Loading and VirtualBox [Delphi]

Posted: Tue Aug 20, 2019 12:02 pm
by Grawol
Hi,
This is my DLL path.

Code: Select all

const

  tDLL = 'DLLs\dosomething.dll';

function DoOne(doNum: integer ): integer;stdcall; external tDLL;

00.jpg

Whenever i run my program, it asking for missing DLL.
Virtualbox with executable files are ok. My problem is only with DLL (static loading).

How to do it correctly ? Should I make dynamic DLL loading ?

Best Regards,

Re: Static DLL Loading and VirtualBox [Delphi]

Posted: Tue Aug 20, 2019 12:22 pm
by Enigma
Hi,

You are doing everything correctly, except some small thing.

When the dll is loaded statically, the system is searching this dll in, eg, Windows, System32 folders and the folder with the protected file. Since you put the dll into DDLs subfolder, even non protected exe should not start because system won't find the dll in the resired places (there is also small remark, system searches for dll in folders, that are added into global PATH variable).

In short, to fix this problem, you need to put the dll into %DEFAULT FOLDER% of Virtual Box, do not put it into DDLs subfolder.

If you plan to use dynamic dll loading, then location of dll does not matter, because you will specify the dll location to LoadLibrary function.

Re: Static DLL Loading and VirtualBox [Delphi]

Posted: Tue Aug 20, 2019 1:24 pm
by Grawol
Hello,
Very clear explanation. Thank you, it is done.

Another question;
If i put an encrypted file, is it possible to decrypt it inside VirtualBox ?

Best Regards,

Re: Static DLL Loading and VirtualBox [Delphi]

Posted: Tue Aug 20, 2019 2:11 pm
by Enigma
Grawol wrote:
Tue Aug 20, 2019 1:24 pm
Another question;
If i put an encrypted file, is it possible to decrypt it inside VirtualBox ?
Yes, that would be possible.

But the behavior depends on how do you plan to decrypt it:
- if you read the file, decrypt it in memory and then use, then it does not matter for Virtual Box at all
- if you decrypt the file and overwrite it (which is also possible), then it will also work, but any changes that you made in virtual files while application work will be discarded after application restart.

Re: Static DLL Loading and VirtualBox [Delphi]

Posted: Thu Aug 22, 2019 3:27 pm
by Grawol
Hello,
I understand. Thank you so much.

More question ;
Is an un-registered application can execute EP_RegKeyInformation ?
I tried this. I delete the registration key, then I load the key (string) to get some TKeyInformation. But have no result.
The string I entered was it's own key (That was a valid key before hardware changes).

I just want to verify that the string was a valid key.
I hope you understand what I mean.

Best Regards,

Re: Static DLL Loading and VirtualBox [Delphi]

Posted: Thu Aug 22, 2019 3:40 pm
by Enigma
Would it be better to call EP_RegCheckKey?

EP_RegKeyInformation can be called when unregistered, no problems, just carefully check the result that it returns, it is not a 0/1 result function.