How to dlopen an unknown version of a library - c

I am trying to load libreadline.so. My code works fine if I give the version number explicitly as in "libreadline.so.6" but fails if I just give "libreadline.so", presumably its just trying to open the file name I give directly. To avoid a future failure when a new version appears, I call dlopen in a loop with the version number counting down to zero. This works and always picks up the latest version of libreadline.
My question is, is there a correct, or better, way of doing this?
I see libreadline.so.6 is a link to libreadline.so.6.3, its a pity they cant have a link from libreadline.so to the latest version.

What about opening the directory which contains all the different files and then comparing the extensions of all files?

Related

VSCODE deletes my library line inclusion when saving automatically

I am programming C on VSCODE but I have this annoying problem. When vscode automatically saves my work, it deletes the line that has the library inclusion that I need. So when I compile it gives me an error that I did not specify the function. Someone can help me?
I don't know how to resolve.
You might have installed a corrupted version of vs code or the library files of the vs code and then location where you are saving your programs might be in different location. For example
The libary files of vs code might be in c drive and the program files might be in onedrive folder.
Try reinstalling it from an authentic source if the second stated problem is not the case. If the problem still continues then please comment down on my reply.
Reinstall either from microsoft store or from
https://code.visualstudio.com/download

PHP error: PHP Startup: Unable to load dynamic library 'php_grpc'

I have tried so many things. Literally taken me a week of trial and error. I managed to get the realtime firebase DB working but not the firestore as I can't call the command
composer require google/cloud-firestore
I have tried fresh installs 3 times for PHP and the other software. This really is not working. Why do I have to use this composer thing and them not just put a zip with all the relevant files inside?
With extension=php.dll in ini:
and changing to aboslute path surrounding extension, with and without .dll I have tried.
I've tried threadsafe and non threadsafe versions, and I also don't know what "1% is not a valid command" is. Also have tried x64 and x86 versions. The previous two images are x86 (which I assume to be 64 as my os is)
Here is an example of a x64 (I assume is 32bit) error. Procedure points cannot be found and it gives an error about entry points.
I have no idea what I did but I fixed it. To those reading this question just make sure in every place there is a php.ini they are the same directory!

Replacing openssl-0.9.8zf with openssl-0.9.8zg causes problems

I am working on a product where its built in two steps:
Step 1:
openssl-0.9.8zf is added as includes for compiling the product, and uses ssleay32.dll and libeay32.dll (of the same version) for linking.
Step 2:
While packaging the product, the above mentioned dlls are replaced with openssl-0.9.8zg version's and openssl.exe file is also added to support another library which loads that in at run time.
However this method is causing problems on which I am not able to lay a finger on. It works perfectly when I use the same version in Step 1 and Step 2. Given that openssl-0.9.8zg is 100% compatible with openssl-0.9.8zf, and that they are dynamically loaded, are there any guesses on what can cause problems?
OpenSSL information on versions: http://abi-laboratory.pro/tracker/timeline/openssl/

App.exe.config not being replaced

I have an application that was shoddily created which resulted in some very sensitive information ending up being potentially very visible within the App.exe.config file after an install. I am presently banging my head against the wall in a thus far futile attempt to delete and replace the .config file via an application update, but all attempts have, as previously stated, proved futile.
My employer is laboring under what I believe to be the delusion that removing the lines in the config file is as simple as writing something into the program that looks at the .config file and deletes them, however 1: I do not think it is that simple and 2: That the file is not being updated with the more recent is indicative of a larger problem that needs to be resolved.
I have tried (in the setup and deployment project) setting the "Remove Previous Versions" to true, and I've incremented both the installer version number and the application version number forward, but neither have worked.
Why is the installed applications app.exe.config not being removed/replaced/updated?
When incrementing your version number make sure you increment at least the third section which is the build number, the fourth section is the revision number which will not force a replacement of the older file. See this MSDN link http://msdn.microsoft.com/en-us/library/aa370859(v=vs.85).aspx
The format is Major.Minor.Build.Revision
From link:
Note that Windows Installer uses only the first three fields of the product version. If you include a fourth field in your product version, the installer ignores the fourth field.

Is it possible to load mismatched symbols in Visual Studio?

I've got a Windows minidump (C code) and a corresponding exe file. Unfortunately, I don't have the exact matching .pdb files, but I do have .pdbs that contain the exact same code just built at a different time. In Windbg, I can use:
.symopt+0x40
To tell it to load anything, even mismatched symbol files. This works great in this particular instance, and I'm able to get a proper call stack. I'm just curious as to whether or not Visual Studio has any such feature. We use pretty much every different version of VS here, so it doesn't matter which version it might be in. Thanks.
Try this utility:
ChkMatch utility can be used to check whether an executable and debug information file match. It can also be used to enforce matching between an executable and debug information file, if they are compatible.
For more information about debug information matching and related issues, see this article.
Supported debug information formats: DBG, PDB 2.0, PDB 7.0...
There is no override, but the poster to this question found a way to modify the PDB files to make them match the EXE.
Thanks to one of the comments on the
first answer, I checked out a link to
the pdfs of the book "Undocumented
Windows 2000 Secrets: A Programmers
Cookbook". And the author goes into
great detail about the pdb file
format. As I said before, I had
already loaded the pdb into a hex
editor and flipped some bits around
appearing that I made the
age/signature match, but it didn't
work. Well, after using the utility
from the W2k secrets book to "explode"
the pdb into the included streams, I
found out that they hide another
reference to the age in stream
3!!!!!!! Once I flipped that one as
well, it matched up in windbg.
Not sure if you want to go to this much trouble, but it looks like it can be done. If this is for production support then it could be worth your while.
Visual Studio and Windbg match pdbs by comparing the timestamps in the Executable header with timestamps store in the pdb file. You can view the timestamp by running dumpin /headers .
I haven't used chkmatch but modifying either the exe or pdb to match each other should work fine.
Be aware that this technique may not be enough to debug your binary. John Robbins in his book 'Debugging Windows' (which I can recommend) mentions that he's seen different build results from the identical source tree built at almost identical times.
Always build pdb symbols with your builds (including release builds) and archive them alongside the build products and include the .map file for good measure.
According to this post its possible to use sos windbg commands as well in visual studio. But i am not sure if ".symopt" also falls into this category.
I'm told that in VS2019 (16.7 .. 16.8 ballpark) that they switched to a multi-threaded PDB file generator to speed that up.
A side effect is that sections of the file, being generated on different threads, may end up in a different order in the file.
Bottom line, it is even more important than before that you use the PDB that was built with the EXE and no other.

Resources