note 66021 added to funcref
| From: | pm_singhin at rediffmail dot com | Date: | Fri, 12 May 2006 10:36:12 +0000 |
| Subject: | note 66021 added to funcref | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111176@lists.php.net to get a copy of this message | ||
This function returns the Product Version as well File Version of any Win32 DLL or EXE.
Parameters :
$prm_file = DLL or EXE file name.
$prm_info = "FileVersion" or "ProductVersion"
This function is still in its infant stage. Future update will contain all the information.
/*---------------------------------------------------
| Function to read version of Win32 .DLL and .EXE |
| Written by Pritpal M. Singh |
| Dtd. 11th May 20006 |
---------------------------------------------------*/
function getBinFileVersion($prm_filename,$prm_info = null)
{
$handle = fopen($prm_filename, "r");
$contents = fread($handle, filesize($prm_filename));
fclose($handle);
($prm_info == null) ? $prm_info = "FileVersion" : trim($prm_info) ;
$cmpString = "";
for($i=0; $i<strlen($prm_info); $i++)
{
$cmpString .= substr($prm_info,$i,1).chr(0);
}
$position = strpos($contents,$cmpString) + strlen($cmpString);
$length = 25;
$tmptext = substr($contents,$position,$length);
$text = "";
for($i=0; $i < strlen($tmptext); $i++)
{
if(ord(substr($tmptext,$i,1)) == 44 || ord(substr($tmptext,$i,1)) == 46 ||
(ord(substr($tmptext,$i,1)) > 47 && ord(substr($tmptext,$i,1)) < 58))
{ $text .= substr($tmptext,$i,1); }
}
$text = trim($text);
if(ord(substr($text,0,1)) < 48 || ord(substr($text,0,1)) > 57)
{ return "No Version Found."; }
else
{ return $text; }
}
----
Server IP: 203.199.124.111
Probable Submitter: 203.193.171.158
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/funcref.php
Edit -- http://master.php.net/note/edit/66021
Del: integrated -- http://master.php.net/note/delete/66021/integrated
Del: useless -- http://master.php.net/note/delete/66021/useless
Del: bad code -- http://master.php.net/note/delete/66021/bad+code
Del: spam -- http://master.php.net/note/delete/66021/spam
Del: non-english -- http://master.php.net/note/delete/66021/non-english
Del: in docs -- http://master.php.net/note/delete/66021/in+docs
Del: other reasons-- http://master.php.net/note/delete/66021
Reject -- http://master.php.net/note/reject/66021
Search -- http://master.php.net/manage/user-notes.php