note 66021 deleted from funcref by nlopess

From: Date: Fri, 12 May 2006 10:41:36 +0000
Subject: note 66021 deleted from funcref by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-111177@lists.php.net to get a copy of this message
Note Submitter: pm_singhin at rediffmail dot com ---- 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; } }

« previous php.notes (#111177) next »