I am using Synapse in a small software (created with Delphi 7) for HTTPS requests. SSL libraries (libeay32.dll/ssleay32.dll) are saved in software resources, so when it opens the dll files are copied to the Windows temp folder. I also use SetDllDirectory pointing to temp folder, so application can "see" the libraries.
For long time, few users were complaining about error 500, so I decided do dig the issue. Discovered that there is another software that record old version of SSL libraries in the Windows system folder, and my software are trying to use them.
Looking in Synapse source I see it calls LoadLibrary without specifying the library path, so I tried to add temp folder to Windows environment path (SetEnvironmentVariable) as suggested in this post Delphi LoadLibrary Failing to find DLL other directory - any good options?, but no success :(
I also tried to load the libraries myself using LoadLibraryEx, with the LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR flag, but again the issue persists...
Please, someone have an idea what is going on and how to solve?
PS. Sorry, english is not my native language
Related
Is it possible to retrieve the published code from an Azure Cloud Service.
When I changed my TFS mapping, TFS wiped out the code I had written on my local machine. It converted the .csproj and .ccprof files to csproj.user and .ccproj.user files. It also removed the solution. I havn't checked anything in since February so checking out loses 3 months worth of code. I have access to some of the views, scripts, and .css files but all .cs files are gone. I have tried the following.
Remote desktop into the published site.
-Works but all .cs files are stored as a .dll and code is lost and
"obfuscated" when decompling.
Wondershare data recovery.
Some files are found but often in an unreadable format. Many are still
missing.
Getting the blob in the vsdeploy folder in Azure Storage.
I have the blob. Now what? Is there a way to convert that back into a readable project?
Using "Open from Azure Website" extension to load the project into visual
studio by the publishsettings file in Azure Portal.
This works great for app services, but I cannot find any existence of a
.PublishSettings file in Azure. The Get-AzurePublishSettingsFile call from
Windows Powershell doesn't not download the correct file. When using the
extension I get a "Object not set to an instance of an object" exception. I
have tested the extension with an app service and it works perfectly.
If you're talking about web/worker roles in a cloud service, then no - you cannot retrieve deployed code. To get code to a cloud service, it gets packaged up first by Visual Studio (or directly through command line tools, or via Eclipse). This entails compiling all of your code first. Source files are not included in the package (unless you've explicitly done something like setting "copy local" to true in the package, which I can't imagine anyone doing).
As far as what's in blob storage: If your .cspkg is still sitting in a blob, sure, you can download and examine it. But again, it'll just contain the same package that was built locally and uploaded during deployment.
With Web Apps, your code will be available in your d:\ drive, since deployments are done via version control (unless you simply ftp something up).
With Virtual Machines (which sit in cloud services in the "classic" deployment model), you would have needed to push code to the VMs on your own (there's no built-in push-from-version-control). So again, unless you pushed source code to the VM, there's no way to retrieve said source code.
As far as the code that was wiped out on your local machine, it might be worth looking into recovery / forensic disk tools (which it looks like you've started doing), to see if your code is still sitting around somewhere, hidden. But, really, how you go about hunting for deleted / overwritten files would be off-topic (or something to ask about on SuperUser).
I was making a Delphi application, and wanted to test it on another PC to see if everything was working properly. I compiled and built the executable file, of course and I transfered all of the files from the Project folder to the other PC. When I launched the .exe file on the PC, nothing would happen. I then ticked the "Build with runtime packages" option in Project Options:
This made the .exe go from around 300 KBs to around 30 KBs, but now, instead of being able to launch the application on another (non-Delphi) PC, that PC got an error saying it was missing various files required to open the .exe .
I sent the same thing to various friends and all reported the same problem.
My application is a rather simple lottery prototype application, so I don't understand why I'm having trouble opening it on other PCs. Are there other special options I need to enable for this to work?
When you use runtime packages, you need to distribute those packages. These are the .bpl files that your program links to. It will be a subset of the packages listed in the runtime packages edit box in your screenshot. You should just list the packages that you use.
The net result of doing this is that the total amount that you will have to distribute is much greater than a single monolithic executable. Because in a monolithic executable the unused code can be stripped. If you want to minimize the size of your program, and make life simple, do not use runtime packages.
It would be worthwhile reading Embarcadero's documentation:
Working with Packages and Components
Solve the first problem.
Using Runtime Packages will not solve the problem of your EXE not running on certain PC's. All it does is increase the complexity of deploying your application (as you have found).
Unless you need Runtime Packages for other, specific reasons, then you are far, far better off NOT using them, especially if you do not understand them (which based on the way you describe having discovered them does appear to be the case, if we're being honest).
Concentrate on finding out why your application does not run as a single, stand-alone EXE.
With all of the problems involving runtime packages your EXE is currently not even reaching the point of running your application code, and this may be where your original problem lies. Which means that once you have solved all the issues created by Runtime Packages, you will stil be left with an EXE which does not run. i.e. your original problem.
What does your application do when it starts ? Does it attempt to load files from any specific locations ? What are those locations ? What are the files ? Are you using any third party libraries which may expect DLL's to be present or other external files ? Are you trying to read or write settings to the registry or any external files (INI files etc).
What is the OS you are trying to run on ? This can be a very significant question for applications compiled with older Delphi versions. Have you tried configuring the EXE to run in Compatibility Mode for older versions of Windows ? (something that you do in Windows itself, not when compiling the EXE).
These are the questions you should be focussing on. Not runtime packages.
Gday,
A small tool that's been around for a while to help you with this is Dependency Walker. You can find it at http://www.dependencywalker.com. It's helped me out on more than one occasion. This will tell you what files (usually BPLs as stated in the other responses) need to be sent with your EXE.
Also look at NSIS to create a simple installer, and put your EXE and supporting BPLs and any other files in the same directory.
In my application (build with Delphi XE8) I use the IdHTTP component. When I tried to run the application, the following exception was thrown: 'Could not load SSL library'.
I solved this issue by downloading the OpenSSL library from this site
http://thundaxsoftware.blogspot.nl/2014/09/cannot-load-ssl-library-using-delphi-xe7.html
If I'm correct: the files 'libeay32.dll' and 'ssleay32.dll' are needed.
But it only works for me. A friend of mine, who also uses this application, got the same error ("Could not load SSL library").
I want others to be able to download my application without them having to download the OpenSSL library seperately.
Is it possible to include these two files into my application?
For example by adding a folder to the directory location of the application? If so, how can I make the application find these files when it needs them?
I hope you can help me! (My apologies for the bad English)
You should bundle the DLLs (and any other necessary files) with your application in an installer. The installer can then install the DLLs in the same folder as your application executable, and your app will be able to find them when it's run. It also makes it much easier for your users to get the files into the proper locations by simply running Setup.exe (or YourAppSetup.exe).
There are several products that will create the installer for you, including the free (written in Delphi) Inno Setup.
The cleanest way to handle this is to deploy the SSL DLLs to the same directory as your executable file.
Assuming that you do not specify a location for the libraries, Indy will default to using the system DLL search order. And the executable file's directory is the top of that search order. So your DLL files will be found.
By supplying these libraries your app is isolated from other applications. That avoids so-called DLL hell where multiple applications share libraries but all have different version requirements.
I am currently encoutering a very strange problem. In one of my applications I use OpenSSL and Indy in order to create a secure TCP connection to a host. I wanted to test if the application (and Indy) are recognizing if the OpenSSL-libraries are missing. Those libraries are placed inside the application folder.
The strange thing is that my application still works fine even though I have removed the libraries. I also removed OpenSSL itself from my computer and searched for any other appearance of the OpenSSL-libraries. There are no OpenSSL-libraries on my computer.
So what is going on? I call the Load() method from IndyOpenSSLHeader in order to load the libraries and guess what...they are loading perfectly. How can this be? There are no libraries on my computer ^^
Btw I did NOT set up a custom library path. I am using the default one which - as far as I know - should be the application folder.
I am using Delphi XE5 and Indy 10 for me application.
What is wrong here?
Thanks in advance!
If you are on iOS then Indy links to OpenSSL statically. On any other platform, there is no possible way that Indy can successfully use OpenSSL SSL/TLS without loading its library files first, so they have to be getting loaded from somewhere you missed. If you are running on Windows, use Process Explorer to see where they are actually being loaded from.
Indy defaults to using the OS search path to load external libraries. The OS defaults to looking in the app's folder, but it can also look in other places as well. You can use Indy's IdOpenSSLSetLibPath() function to specify where you want OpenSSL loaded from (there is a similar function for ZLib - IdZLibSetLibPath()). This is good to ensure your app loads the libraries only from your app's folder and nowhere else, in case someone maliciously deletes the libraries from your app's folder in an attempt to trick it into loading the libraries from another path on the OS's search path. It is also good for testing purposes if you just want to see how your app reacts when the libraries are missing, without having to actually delete them.
They may be statically linked into your binary.
Also, there is a lot of places where SSL libraries could be.
See this article (Search Order for Desktop Applications):
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx
I have two PCs both with XE2. I thought that I had installed identically on both but have problems installing 3rd party packages on one while the other is just fine.
I want the same on both anyway. The easist would probably just to "migrate" the working set-up by moving in into my Dropbox folder. Can I do that? If so, how?
If not, can I (easilly) backup my registry settings on one machine and then import them on the other?
I suppose I could just sort out the problem on the one PC, but am not having much luck so far. I would rather invest the time in only having one Delphi setup. And since I am moving lots of other stuff to DropBox anyway ...
The tool for this is now built into Delphi XE8 and higher.
It's found here:
C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\migrationtool.exe
Online documentation:
http://docwiki.embarcadero.com/RADStudio/Rio/en/Settings_Migration_Tool
Install CnPack wizards from http://www.cnpack.org
From the CnPack toolbar select IDE Config Backup/Restore (image below) and save this file somewhere safe
Copy the components to the second delphi machine . Keep the exact same directory structure.
I store my components as follows this helps backing up, moving etc., but you can use your own structure
D:\components_bds\DCU
D:\components_bds\BPL
D:\components_bds\ComponentsThemselves
Use the restore config file from CnPack to restore your components on the new machine
This is also useful if your testing components that you plan to remove later and keeping a backup of your installation incase something goes wrong you can save time with new delphi installation if hard drive dies. Keep a copy on flashdrive or somewhere safe
You may compare/diff the config file created by cnPack using a tool like Beyond Compare and see what the differences are to find out why third party components give problems on one of the machines. It may be a Delphi registry/installation problem or a problem in the paths of the thirdparty components. Components need to be installed in an order perhaps it did not find the needed dcu or dll it depends on.
I don't know of any way to do so with DropBox. Here's an old post I made (related to Delphi 7, but with correction of registry keys still applicable) in the CodeGear newsgroups; hopefully it will help.
(It probably goes without saying, but back up the existing registry settings on the destination machine before starting by using RegEdit and exporting them, just in case. You'll at least be able to get back to the point you're at now if something goes wrong by deleting the imported entries and then importing the saved ones.)
You can't, without some difficulty anyway. (Especially if you have
third party components installed, as they may have placed files in the
%SYSTEM% folder you may not know about.)
You may be able to (for going from the old computer to the new
computer running the same exact version of Windows!) by exporting the
registry keys under HKCU\Software\Embarcadero and
HKLM\Software\Embarcadero from the old machine, and then after
installing Delphi on the new machine (in the exact same folder
location) importing that registry file.
Many of the compiler, linker, and other settings are configured on a
per-project basis, and should transfer over when you move your source
code to the new machine.
Third-party components are a problem, as I mentioned above. You may be
able to get away with using the registry export/import if you copy
each third-party component set from the old computer into exactly
the same location on the new machine before importing the registry
file. You'll probably have to track down some .BPL files that end up
in the $(BDS)\Bin and possibly other folders under the $(BDS)
tree; the IDE will tell you about missing stuff when you try and start
it. Make sure you answer "Yes " when asked if you want to try and load
it again next time!
Most of my development is hobby stuff or wannabe releases. Instead of dying trying to move my XE2 Pro from my Dell Inspiron N7110 Win 7 machine to my new Win 10 SSD machine, I'm seriously thinking of switching to Lazarus. I've used Lazarus 2.x with Indy 10, ZeosLib, and Firebird and successfully created a working distributed internet system. I also created Lazarus version of my XE2 Blackjack program. When compared to XE2, Lazarus (IMO) has only two weakness and neither are deal breakers for me. BTW, I have successfully duplicated Lazarus (with all installed components) from one machine to another simply by copying and pasting the Lazarus directory and it works. Try that with Delphi.
Sam