![]() |
Is it possible to locate a file from version information property?
well, here is the scenario. I want to check a target machine if "myapp.dll" is installed and update it if needed with new one. Some strange user for some strange reason has renamed "myapp.dll" in "another.dll". As far as I know by any documented way, there is not way to search and locate the file. My question is, could be possible to search all files in a dir looking at version information property tab? For example in description or in comments or in original file name? Is it possible for someone to grab such info?
Note that the file is not shared or self registered etc so there are not any info in registry. P.S. OK, someone would say that the above is useless in real world. It is just a study affair. |
Have you looked into http://nsis.sourceforge.net/wiki/MD5_plugin ?
|
That there ^^ is your best solution.
Iterate through the files with FindFirst, FindNext, FindClose and compare each found files' MD5 checksum with a hardcoded checksum in a !define of the particular dll file that you are after. Obviously though if there are a lot of dll files in the folder it could take a while. If this is the case you could get a count of the files in the directory first and show a progress banner with the Banner plugin. -Stu |
MD5 plugin usedcode: |
Thank you all!
i would say that the best reason why one should use NSIS is the instant and detailed feedback from the community. As I am examining the above by instructor I am able to find any file that I am looking for. Therefore, I understand that the conclusion is that it is not possible to grab details from the version information property tab. |
It probably is possible, but using an MD5 would be a better solution as an MD5 checksum is unique to every non-identical file.
-Stu |
I guess the only problem is that that's probably the least scaleable solution possible :)
|
Quote:
http://nsis.sourceforge.net/MoreInfo_plug-in |
well, MoreInfo plug-in is not the case since it requires a specific file name in the filename parameter, thereby it is useless on the above scenario.
|
Red Wine,
please see the example code from Instructor, the same method can be used with the MoreInfo plugin, just iterate through all the files matching your search filter. So it's not useless :) |
Quote:
Could you please set up an example just like the way Instructor did? Thanks in advance |
$R9 is the dll path and name.
-Stu |
Red Wine:
See Instructors code above, do you see the LocateCallback function? That is where all the work takes place. This function gets called for each file that matches the search pattern. Now, instead of code: just use any suitable function from the MoreInfo plugin. $R9 contains the full path and filename of the file found. I am too lazy to make up some sample code now, as I am still chewing on strange skinning effects, but I am sure you can figure it out now :) If not, please ask again and I'll whip up some sample code. |
1 Attachment(s)
I think I'll figure it out now, thanks.
BTW examining some of the above I made a kind of auto creation for MD5 checksums. Please take a look. |
It took me a while, though, I figured out how it works.
With the compination of Locate and MoreInfo plug-in is possible to find any file in a target without the need to provide the file name nor the exact file size. All it needs is the file extension and the info from a supported by MoreInfo plug-in field. code: |
1 Attachment(s)
According to my quest for the given above scenario I had to navigate through the maze of several NSIS plugins and headers. The benefit is that I got my self a little deeper inside NSIS scripting and being able to make a fancy gui frontend for the md5dll. As far as I'm testing it on my XP-SP2 system I can't find any noteworthy bug. I'd like to kindly request the community to examine it and drop me a note if there is any.
The NSIS script: code: The InstallOptions INI: code: |
| All times are GMT. The time now is 17:54. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.