获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)
Type TFileVersionInfo = Record
FixedInfo:TVSFixedFileInfo; {版本信息}
CompanyName:String; {公司名称}
FileDescription:String; {说明}
FileVersion:String; {文件版本}
InternalName:String; {内部名称}
LegalCopyright:String; {版权}
LegalTrademarks:String; {合法商标}
OriginalFilename:String; {源文件名}
ProductName:String; {产品名称}
ProductVersion:String; {产品版本}
Comments:String; {备注}
LocalPort:String; {Local UDP_Message Port}
end;
Function GetFileVerInfo(ExeFileName :Pchar;var VerSionInfo:TFileVersionInfo):Boolean;
var
dwHandle, dwVersionSize : DWORD;
Find : String;
pcBuffer : PChar;
pTemp : Pointer;
FileVersionInfo : TVSFixedFileInfo;
begin
Find := '/';
dwVersionSize := GetFileVersionInfoSize( PChar(ExeFilename),dwHandle );
if dwVersionSize = 0 then begin
Result:=False;
Exit;
end;
GetMem( pcBuffer, dwVersionSize );
if not GetFileVersionInfo( PChar(ExeFilename),dwHandle,dwVersionSize,pcBuffer ) then begin
FreeMem(pcBuffer);
Result:=False;
Exit;
end;
if not VerQueryValue( pcBuffer,PChar(Find),pTemp,dwVersionSize ) then begin
FreeMem(pcBuffer);
Result:=False;
Exit;
end;
FileVersionInfo:=PVSFixedFileInfo(pTemp)^;
With FileVersionInfo do begin
VersionInfo.FixedInfo.dwSignature:=dwSignature;
VersionInfo.FixedInfo.dwStrucVersion:=dwStrucVersion;
VersionInfo.FixedInfo.dwFileVersionMS:=dwFileVersionMS;
VersionInfo.FixedInfo.dwFileVersionLS:=dwFileVersionLS;
VersionInfo.FixedInfo.dwProductVersionMS:=dwProductVersionMS;
VersionInfo.FixedInfo.dwProductVersionLS:=dwProductVersionLS;
VersionInfo.FixedInfo.dwFileFlagsMask:=FileVersionInfo.dwFileFlagsMask;
VersionInfo.FixedInfo.dwFileFlags:=fileVersionInfo.dwFileFlags;
VersionInfo.FixedInfo.dwFileOS:=FileVersionInfo.dwFileOS;
VersionInfo.FixedInfo.dwFileType:=FileVersionInfo.dwFileType;
VersionInfo.FixedInfo.dwFileSubtype:=FileVersionInfo.dwFileSubtype;
VersionInfo.FixedInfo.dwFileDateMS:=FileVersionInfo.dwFileDateMS;
VersionInfo.FixedInfo.dwFileDateLS:=FileVersionInfo.dwFileDateLS;
end;
Find := '/StringFileInfo/080403A8/';
if VerQueryValue( pcBuffer,PChar(Find+'CompanyName'),pTemp,dwVersionSize ) then
VersionInfo.CompanyName:=PChar(pTemp)
else begin
Find := '/StringFileInfo/040904E4/';
if VerQueryValue( pcBuffer,PChar(Find+'CompanyName'),pTemp,dwVersionSize ) then
VersionInfo.CompanyName:=PChar(pTemp)
else begin
Result:=False;
Exit;
end;
end;
if VerQueryValue( pcBuffer,PChar(Find+'FileDescription'),pTemp,dwVersionSize ) then
VersionInfo.FileDescription:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'FileVersion'),pTemp,dwVersionSize ) then
VersionInfo.FileVersion:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'InternalName'),pTemp,dwVersionSize ) then
VersionInfo.InternalName:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'LegalCopyright'),pTemp,dwVersionSize ) then
VersionInfo.LegalCopyright:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'LegalTrademarks'),pTemp,dwVersionSize ) then
VersionInfo.LegalTrademarks:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'OriginalFilename'),pTemp,dwVersionSize ) then
VersionInfo.OriginalFilename:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'ProductName'),pTemp,dwVersionSize ) then
VersionInfo.ProductName:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'ProductVersion'),pTemp,dwVersionSize ) then
VersionInfo.ProductVersion:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'Comments'),pTemp,dwVersionSize ) then
VersionInfo.Comments:=PChar(pTemp);
if VerQueryValue( pcBuffer,PChar(Find+'LocalPort'),pTemp,dwVersionSize ) then
VersionInfo.LocalPort:=PChar(pTemp)
else
VersionInfo.LocalPort:='66500';
FreeMem(pcBuffer );
Result:=True;
end;
http://blog.csdn.net/henreash/article/details/2246774
获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)的更多相关文章
- mfc获取exe的版本信息
CString GetFileVersion(const CString& sTargetFileName){ DWORD nInfoSize = 0, dwHandle = 0; nInfo ...
- Python获取exe文件版本
import time, datetime, re, subprocess, sys, os, win32net, win32api, win32con, win32netcon, win32secu ...
- 获取 Android APP 版本信息工具类(转载)
获取 Android APP 版本信息工具类 获取手机APP版本信息工具类 1.获取版本名称 2.获取版本号 3.获取App的名称 package com.mingyue.nanshuibeidiao ...
- Powershell 获取文件版本信息
获取文件版本信息,通过FileVersionInfo::GetVersioninfo(file) 来获取信息 function Check-DdpstoreFileVersion{ $Ddpstore ...
- LevelDB源码之五Current文件\Manifest文件\版本信息
版本信息有什么用?先来简要说明三个类的具体用途: Version:代表了某一时刻的数据库版本信息,版本信息的主要内容是当前各个Level的SSTable数据文件列表. VersionSet:维护了一份 ...
- E1.获取Elixir/Erlang版本信息
E1.获取Elixir/Erlang版本信息 获取Elixir版本 直接在shel中打开iex (interactive shell),就可以查到具体的版本信息: iex Erlang/OTP 22 ...
- 实现php获取mp3文件元信息如播放时间歌曲作者等
最近收集到一个php获取mp3文件元信息的类,感觉比较方便.现在分享给大家! 下面是使用方式和测试方式: <?php include_once 'mp3file.class.php'; func ...
- [转]SVN使用log,list,cat,diff查看所有及特定文件版本信息
[转]SVN使用log,list,cat,diff查看所有及特定文件版本信息 http://onefishum.blog.163.com/blog/static/5184730520113153402 ...
- linux 系统获得当前文件夹下存在的所有文件 scandir函数和struct dirent **namelist结构体[转]
linux 系统获得当前文件夹下存在的所有文件 scandir函数和struct dirent **namelist结构体 1.引用头文件#include<dirent.h> struct ...
随机推荐
- 关于C++异常机制的笔记(SEH, try-catch)
昨天晚上加班解决了一个问题,是由于无法正确的捕获到异常导致的.刚开始用try-catch,但是没法捕获到异常:后面改成SEH异常才解决.因此今天将这个问题重新梳理了一遍,关于try-catch, SE ...
- Mars的mp3实例
Mars的mp3实例第一课: 关于menu: package mars.mp3player01; import mars.down.HttpDownloader; import android.app ...
- 《Python爬虫学习系列教程》学习笔记
http://cuiqingcai.com/1052.html 大家好哈,我呢最近在学习Python爬虫,感觉非常有意思,真的让生活可以方便很多.学习过程中我把一些学习的笔记总结下来,还记录了一些自己 ...
- 解决linux下javac -version和java -version版本显示不一致
解决linux下javac -version和java -version版本显示不一致 [javascript] view plaincopy [root@localhost usr]# $JAVA_ ...
- oracle忘记密码,修改密码,解锁
忘记密码修改密码: alter user system identified by values abc111; 修改后的用户名system,密码abc111. 解锁: cmd->输入 :sql ...
- 来推荐个免费的PPT演示工具--ZohoShowTime
事实上这个不算新产品了,这次是做了一些大的改进.上次在Zoho的全球用户大会上,全程演讲都是用的这个工具.Zoho这点非常好啊.自己的产品自己带头用.个人认为它最大的用处就是.离得远的观众能够在自己的 ...
- 改动导航栏上返回button上的字,比如把back改动为返回
改动导航栏上返回button上的字,比如把back改动为返回 注意:这个须要在跳转之前到视图控制器中写,而不是在跳转之后到控制器中写 UIBarButtonItem *backIetm = [[UIB ...
- winform窗体全屏
bool fullscreen = false;Rectangle rect = new Rectangle();private void button4_Click(object sender, E ...
- js实现相册翻页,滚动,切换,轮播功能
我们在做web开发的时候,前台的效果要求是很高的,因为对于不懂程序的用户来说,前台的视觉冲击,无疑是对我们产品的第一印象. 在完成web图片各种功能上,很多框架有很绚丽的效果,但今天我们来看看用原生的 ...
- Microsoft Visual C++运行库合集下载(静默安装)
Microsoft Visual C++运行库合集下载 CN启示录2013-06-02上传 Microsoft Visual C++运行库合集由国外网友McRip制作,包含了VC2005.VC20 ...