3

So my applications in Delphi 2007 use TClientdataset features and i need to deploy MIDAS.DLL with it. I put the library in the same folder the EXE file is located.

Usually it runs fine but in some machines (and i don't know what these machines had in 'special'), even the MIDAS.DLL being in the same EXE folder, when the user try to open it the exception 'Error loading MIDAS.DLL' is throwed.

In these cases, what i need to do is :

1 - Copy MIDAS.DLL to c:\windows\system32 (32 bit Windows) or c:\windows\syswow64 (64 bit Windows)

2 - Run the command 'regsvr32 midas.dll' in prompt running as administrator.

Although this procedure solves the problem, when the issue happen i need to remotely access the customer machine to do the procedure, and this isn't always an option.

I tried the include Midaslib in the uses clause of my app, but because i use a Asprotect to encrypt the EXE (to avoid cracking), it won't execute if Midaslib is present.

Does anybody know why this problem happens and possible workarounds ?

Thanks !

delphirules
  • 6,443
  • 17
  • 59
  • 108
  • 5
    If you add *MidasLib* to your uses clause, you no longer have to distribute Midas.DLL. – Ken White Feb 06 '19 at 13:22
  • 1
    I remember including a app.exe.local file with a D2007 application using dbexpress ([link](https://learn.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-redirection)), though I don't remember the exact reason (midas or fbclient?) and if it helped. – Sertac Akyuz Feb 06 '19 at 13:25
  • 4
    Don't ever save DLLs in the system directories. What happens if two programs want to do that with different versions of the DLL? – David Heffernan Feb 06 '19 at 13:30
  • @KenWhite I tried the include Midaslib in the uses clause of my app, but because i use a Asprotect to encrypt the EXE (to avoid cracking), it won't execute if Midaslib is present. – delphirules Feb 06 '19 at 15:50
  • @DavidHeffernan I know this is not a good practice, but it's the only workaround i could find at the moment – delphirules Feb 06 '19 at 15:52
  • It's not the solution though. Typically when you want to make a DLL available to your program, you place it in the same directory as your executable file. – David Heffernan Feb 06 '19 at 16:01
  • We've had that error too. Regarding this I've got a note about a registry entry `HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Classes\CLSID\{9E8D2FA1-591C-11D0-BF52-0020AF32BD64}\InProcServer32` pointing to the midas.dll. IIRC Delphi creates that entry., maybe other installers too. – Uli Gerhardt Feb 06 '19 at 16:07
  • @UliGerhardt What did you do to avoid this issue in the future ? – delphirules Feb 06 '19 at 16:48
  • @UliGerhardt: That's correct. Before your comment, I was just about to point out to the OP that the only way to get Midas.Dll to load correctly is for it to be located where the registry entry points to. Hopefully the OP is aware that the registry entry can be updated from the command line by `tregsvr Midas.Dll' executed in the directory where the DLL is located. – MartynA Feb 06 '19 at 18:08
  • @delphirules AFAIR there were corrupted registry entries with some customers. We instructed our support people to make sure there was either **no** registry entry or a valid one. Do you have such an entry? – Uli Gerhardt Feb 06 '19 at 18:41

0 Answers0